Fids
Fids

Reputation: 151

Sending Ctrl + Z in a string in C++

A quick question... I'm trying to send Ctrl + Z as part of a string that is sent to a proxy (that sends an AT command to send an SMS).

The problem arises because the user can enter in their command, and then I will take that (as well as the rest of the string to send the SMS) and then change to mean Ctrl + Z.

I have looked it up already and I am trying to replace in the string with \u001A... it still doesn't seem to work. Infact, when compiling (this is in VC6) it says:

"warning C4129: 'u' : unrecognized character escape sequence"

...could this have anything to do with why it isn't working? I've tried everything!

Thanks!

Upvotes: 1

Views: 2338

Answers (2)

bert-jan
bert-jan

Reputation: 968

To insert a none printable character in a string constant, use \<octal-code>, where octal code is 8-digit-encoded number. Ctrl-Z is 26, that's \032, if I am not wrong.

Upvotes: 0

Some programmer dude
Some programmer dude

Reputation: 409196

VC6 is ancient, and probably doesn't support unicode escape sequences. Instead of using \u001a, try \x1a?

Upvotes: 4

Related Questions