| | |
Convert ANSI characters to character
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2008
Posts: 99
Reputation:
Solved Threads: 1
Well in VB6 they use Chr()
example:
Just wondering if there is a similar function in c++?
example:
C++ Syntax (Toggle Plain Text)
Do sChar = Chr(GetRandomNumber()) Loop While sChar = Chr(34)
Just wondering if there is a similar function in c++?
•
•
•
•
Well in VB6 they use Chr()
example:
C++ Syntax (Toggle Plain Text)
Do sChar = Chr(GetRandomNumber()) Loop While sChar = Chr(34)
Just wondering if there is a similar function in c++?
while( sChar == 34) or
while( sChar == '\"') Last edited by Ancient Dragon; Jul 8th, 2008 at 9:15 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Ancient Dragon said it all. char in C/C++ actually is a 8-bits integer ranging from 0 to 255. So you can write something like this:
C++ Syntax (Toggle Plain Text)
for( sChar = rand()%256; sChar == 34; sChar = rand()%256);
Last edited by invisal; Jul 8th, 2008 at 10:25 am.
Yesterday is a history, tomorrow is a mystery, today is a gift.
Behind every smile is a tear.
Visal .In
Behind every smile is a tear.
Visal .In
>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.
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.
I'm here to prove you wrong.
•
•
•
•
>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.
Yesterday is a history, tomorrow is a mystery, today is a gift.
Behind every smile is a tear.
Visal .In
Behind every smile is a tear.
Visal .In
•
•
Join Date: Mar 2008
Posts: 1,442
Reputation:
Solved Threads: 118
Yep, there was a discussion on that not so long ago on the last few posts. http://www.daniweb.com/forums/thread130222.html
I need pageviews! most fun profile ever :)
![]() |
Similar Threads
- Cannot convert 'AnsiString' to 'const char *' (C++)
- C serial com port terminal program (C)
- error C2375: 'my_strdup' : redefinition; different linkage (C++)
- Coverting a string to a byte array (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: Time and Date Display
- Next Thread: Conversion from int to double
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






