LCKB
Conversion from string to long - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196)
+---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192)
+---- Thread: Conversion from string to long (/showthread.php?tid=2269)



- soryjero - 07-26-2013


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




- someone - 07-26-2013


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

 




- soryjero - 07-27-2013



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




- Paramount - 07-28-2013



it works perfectly.

 

thanks again wiza Smile

Wiza?

...




- Johnny5 - 07-28-2013

Topic Closed by a moderator. The reason why: Solved