Click here to Skip to main content
15,895,084 members
Home / Discussions / C#
   

C#

 
GeneralRe: Only exposing interfaces from the server Pin
Arjan Einbu20-May-03 20:49
Arjan Einbu20-May-03 20:49 
GeneralRe: Only exposing interfaces from the server Pin
Adam Turner20-May-03 23:08
Adam Turner20-May-03 23:08 
GeneralReducing the size of an Array Pin
Adam Turner20-May-03 15:16
Adam Turner20-May-03 15:16 
GeneralRe: Reducing the size of an Array Pin
firat kocak20-May-03 20:49
firat kocak20-May-03 20:49 
GeneralRe: Reducing the size of an Array Pin
Arjan Einbu20-May-03 20:57
Arjan Einbu20-May-03 20:57 
GeneralImplementing Serial number / Trial version Pin
Bog20-May-03 7:59
Bog20-May-03 7:59 
GeneralRe: Implementing Serial number / Trial version Pin
Daniel Turini20-May-03 8:27
Daniel Turini20-May-03 8:27 
GeneralRe: Implementing Serial number / Trial version Pin
Patrick Lassalle20-May-03 9:24
Patrick Lassalle20-May-03 9:24 
GeneralRe: Implementing Serial number / Trial version Pin
shaunAustin21-May-03 3:59
shaunAustin21-May-03 3:59 
GeneralRe: Implementing Serial number / Trial version Pin
Daniel Turini21-May-03 5:34
Daniel Turini21-May-03 5:34 
GeneralRe: Implementing Serial number / Trial version Pin
BigAndy21-May-03 5:49
BigAndy21-May-03 5:49 
GeneralRe: Implementing Serial number / Trial version Pin
leppie21-May-03 13:09
leppie21-May-03 13:09 
Generalquestion about crystal reports 9 Pin
cruscal20-May-03 7:24
cruscal20-May-03 7:24 
GeneralRe: question about crystal reports 9 Pin
Mazdak20-May-03 8:52
Mazdak20-May-03 8:52 
GeneralRe: question about crystal reports 9 Pin
cruscal21-May-03 5:19
cruscal21-May-03 5:19 
GeneralPacket Capture Project Pin
firat kocak20-May-03 6:43
firat kocak20-May-03 6:43 
QuestionReading a Random Access file.. how to parse bytes? Pin
dazinith20-May-03 5:03
dazinith20-May-03 5:03 
AnswerRe: Reading a Random Access file.. how to parse bytes? Pin
firat kocak20-May-03 6:26
firat kocak20-May-03 6:26 
GeneralRe: Reading a Random Access file.. how to parse bytes? Pin
dazinith20-May-03 7:22
dazinith20-May-03 7:22 
GeneralRe: Reading a Random Access file.. how to parse bytes? Pin
dazinith20-May-03 7:43
dazinith20-May-03 7:43 
GeneralRe: Reading a Random Access file.. how to parse bytes? Pin
dazinith20-May-03 8:26
dazinith20-May-03 8:26 
GeneralRe: Reading a Random Access file.. how to parse bytes? Pin
leppie20-May-03 11:37
leppie20-May-03 11:37 
GeneralRe: Reading a Random Access file.. how to parse bytes? Pin
firat kocak20-May-03 20:42
firat kocak20-May-03 20:42 
way - 1 : it may be unsafe. but unsafe doesn't mean that it is really unsafe Smile | :) . it means that "be carefulu on using unsafe, if you incorrectly use it you may crash the system LOL ). bu if you want your code pure Managed then you are wright.

way - 2 : When you wrote an int value to a file or a memory it is written as fallows,
first low part of the value and then the high part.
2 bytes value (byte0-byte1) byte1 and then byte2
4 bytes value (byte0-byte1-byte2-byte3) byte3 and then byte2 and then byte1 and latest byte0

So you must know the layout of the value of the byte array you try to read from a file. so lıater you can write the function below to read different types of value from a byte array

public static bool GetBool( byte [] MyData , int index )
{
return ( MyData[ index ] == 0 ? false : true );
}

public static short GetShort( byte [] MyData , int index )
{
short s = 0;

s = (short) ( ( ( int ) MyData[ index + 1 ] ) << 8 );
s += (short ) Mydata[ index ];

return s;
}

public static int GetInt( byte [] MyData , int index )
{
int s = 0;

s = ( ( int ) MyData[ index + 3 ] ) << 24;
s = ( ( int ) MyData[ index + 2 ] ) << 16;
s = ( ( int ) MyData[ index + 1 ] ) << 8;
s += ( int ) Mydata[ index ];

return s;
}

public static string GetString( byte [] MyData , int index , int len )
{
string s;

s = Encoding.ASCII.GetString( MyData , index , len );

return s;
}

Before converting date values from a byte array, you must know what format it has. Because i don't know the format, so i cann't help you

cheers,

Doing something is better than doing nothing. So ... Move !
AnswerRe: Reading a Random Access file.. how to parse bytes? Pin
Nathan Blomquist21-May-03 1:47
Nathan Blomquist21-May-03 1:47 
GeneralAutocompletion in DropDown ComboBox Pin
Braulio Dez20-May-03 0:22
Braulio Dez20-May-03 0:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.