Conversion from string to long
#1

hello, i am trying to convert a string to long to be able to read that position from gs.

 

i have this offset: 000ff886.

 

i have saved it in a string variable, but i need to convert it to long to be able to asign it to fs.position = "offset in long format".

 

i have tried this:

long.TryParse(Data[i].offset, out aux_off);
fs.Position = aux_off;

//where aux_off is format long
//and Data[i].offsets is format string

but i get aux_off = 0 and

 

2

 

2

 

would be aux_off = 1046662.

 

so, could anyone tell me how to convert it correctly because i cant get it correctly with code i have posted here.

 

thanks in advance

#2

Same result:

UInt32 i= Convert.ToUInt32("0x0C", 16);
UInt32 j= Convert.ToUInt32("0C", 16);

If your app is a 32 bit application, dont use long because long is a signed Int64 (2 at power of 64), if it is a 64 bit application use ulong, or UInt64.

2

 

#3


Same result:

UInt32 i= Convert.ToUInt32("0x0C", 16);
UInt32 j= Convert.ToUInt32("0C", 16);

If your app is a 32 bit application, dont use long because long is a signed Int64 (2 at power of 64), if it is a 64 bit application use ulong, or UInt64.

2

 

 

it works perfectly.

 

thanks again wiza Smile

#4


it works perfectly.

 

thanks again wiza Smile

Wiza?

...

#5
Topic Closed by a moderator. The reason why: Solved



Forum Jump:


Users browsing this thread: 1 Guest(s)