Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ULARGE to String conversion 2

Status
Not open for further replies.

gforce2002

Programmer
Jan 30, 2003
24
CA
Does anyone know how to convert a ULARGE_INTEGER value (as in one of the parameters from the GetDiskFreeSpaceEx function) into a string value which can used in concatenation? The itoa and related function won't work.

Any advice would be greatly appreciated!
 
Why don;t they work?
It's just an _int64, isn't it? Then why does _64toa work?

Greetings,
Rick
 
Sorry should have been "Why doesn't _64toa work?"

Greetings,
Rick
 
I've tried the i64toa function and get the following compile error:

'_ui64toa' : cannot convert parameter 1 from 'union _ULARGE_INTEGER *' to 'unsigned __int64'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast

I'm pretty new to C++, but I think that ULARGE values are stored differently than a "regular" long integer.
 
Oops that was with the _ui64toa function. With the _i64toa function, it's this:

error C2664: '_i64toa' : cannot convert parameter 1 from 'union _ULARGE_INTEGER *' to '__int64'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast

And I get the same type of error with ANY variation of the itoa functions...
 
Then cast the ULARGE_INTEGER to __int64:

__int64 i64 = (__int64)x

Greetings,
Rick
 
LazyMe, because I am a total C++ neophyte, can you elaborate on the syntax that would be used for this, say if the ULARGE_INTEGER variable is called largeint ?

Thanks for the help!
 
Try this:

char[64] c={0};
_ui64toa((unsigned __int64)largeint, c, 10);

Greetings,
Rick
 
Sorry, that of course was rubbish.
This will work better:

char c[64]={0}; //Typo...
_ui64toa(largeint.Quadpart, c, 10) //(don't think the cast will work either...)



Greetings,
Rick
 
Getting closer... now I get the error

error C2039: 'Quadpart' : is not a member of '_ULARGE_INTEGER'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\winnt.h(372) : see declaration of '_ULARGE_INTEGER'

Help! :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top