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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add character to an ansistring ?

Status
Not open for further replies.

Tremorblue

Programmer
Apr 30, 2004
56
GB
I want to create a string that contains non visual characters.

e.g ASCII 0x6 - ACK

In Delphi its something like
aString := 'Test'#6;


How can I do this ?
 
I'm not certain that this is what you're looking for, but here it is (untested, of course)

char nvschar;
AnsiString str;

nvschar = {code of char}
str = "Test" + AnsiString(nvschar);

Bug in your code! Need a quick fix fast!
Need Help from a programming expert! Click on the site below. We're here to help!
 
str.sprintf("Test%c",0x6);

That seems to do the trick.
 
aOutMessage.sprintf("test%c",0x6);

Seems to do the trick
 
Well, as you uses constants:
const char * Some_Text = "Test\x06";
const char * Some_Text = "Test" 0x06;

Totte
Keep making it perfect and it will end up broken.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top