![]() |
|
Delphi Pascal & Builder C++ Character Problem |
Grudge
Member #958
February 2001
![]() |
In Pascal (Delphi), if I wanted to use control characters, I would use // setup control characters STX := Chr(2); ETX := Chr(3); ESC := Chr(27); ... but how would I go and do it for c++ in builder, there is no Chr command (not in Builder C++ 6 anyways). Any ideas ? -- |
X-G
Member #856
December 2000
![]() |
char stx = 2; char etx = 3; char esc = 27;
Remember, chars are integral types. -- |
Grudge
Member #958
February 2001
![]() |
ok, but if I use it in a ansistring, would the following work AnsiString Output = stx + "whatevertext"; would the output be : '3whatever' ? or would it have the actual control character in the string (instead of 3) ? -- |
X-G
Member #856
December 2000
![]() |
I don't know what an AnsiString is, but the char will have the value 3. Not the literal '3', which is ascii value 51. char a; // These two are equivalent a = '3'; a = 51;
-- |
Niunio
Member #1,975
March 2002
![]() |
Try next: char *ETX = {'3', 0}; Now, you can use strcat. ----------------- |
X-G
Member #856
December 2000
![]() |
A string isn't the same as a char. Depends on what you want to use it for, of course. -- |
|