Well in VB6 they use Chr()
example:
Do
sChar = Chr(GetRandomNumber())
Loop While sChar = Chr(34)
Just wondering if there is a similar function in c++?
Its not necessary to do that in C++ or C. A char can be freely used as either an integer or a character. Both the following are correct (equivalent). while( sChar == 34)
or while( sChar == '\"')
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
>char in C/C++ actually is a 8-bits integer ranging from 0 to 255.
While that may be true on your PC, C and C++ don't require char to be an 8-bit type. Further, vanilla char is allowed to be either signed or unsigned (the choice is made by your compiler), in which case even an 8-bit char may not have the range you specified.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129