Qbasicnews.com

Full Version: CHR$() equivalent in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What is it? I'm trying to write a program which adds some specific ascii codes to a string.
You don't need to convert, just use a char:
Code:
char c = 65;
printf("c = %c\n", c);
Will print:
Code:
c = A
Can I do that with strcat? I'm trying to make a string to print to the system with system().
You may be better using sprintf, or if you are using Linux and don't mind your code being unportable you can use asprintf.
Actually it's Knoppix. And it's someone else's system, but we won't g there right now....