David Gibbs <dagibbs@qnx.com> wrote:
Chris Nasr <> cnasr@mechtronix.ca> > wrote:
David,
Thanks enourmously, that works, I think perhaps printf was misunderstanding my
string and formatting it wrong, doing each letter one at a time as in your second
example (or the first one) fixed everything.
The \x escapes are handled by the C compiler, not by printf – printf
never sees them.
THe problem with \x is it is that it is a multi-character escape,
and you gave: \x1b4017 – which digit is the last of the hex
digits? K&R says, “There is no limit to the number of digits,
but the behaviour is undefined if the resulting character value
exceeds that of the largest character.”
Undefined land is not a good place to go.
Your kidding right? Undefined land is a great place! Everything there
speaks gibberish, so why try to make sense of it all? Just sit
back and let those silly little characters wave their hands in the air
and yell their funny little language, while you just laugh.
Sorry, the blinking lights in my cube finally got to me.
E.
-David
David Gibbs wrote:
Chris Nasr <> cnasr@mechtronix.ca> > wrote:
David,
Thanks for the help. I have tried using the escape codes provided in the help
for Dev.con, both in QNX mode and ansi mode, but nothing appears to happen.
i.e. I do the following
printf(“\x1b4017”);
The following worked for me in QNX mode in a pterm:
#include <stdio.h
int main()
{
printf(“%c%c40”, 0x1b, 0x40);
}
If you wish to do it all in \x escape sequences:
printf(“\x1b\x40\x34\x30”);
would do it.
Compiling your test program, then piping the output to hd can be
very helpful for seeing what output bytes are actually generated
by your printf string.
e.g. I called my program col.c and compiled it to col:
col | hd
gave:
0000000 1b 40 34 30 .@40
0000003
Which is what I wanted.
-David
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.