Qbasicnews.com

General => General Programming => Topic started by: Skyler on April 24, 2007, 01:07:15 PM



Title: CHR$() equivalent in C
Post by: Skyler on April 24, 2007, 01:07:15 PM
What is it? I'm trying to write a program which adds some specific ascii codes to a string.


Title: CHR$() equivalent in C
Post by: LooseCaboose on April 24, 2007, 06:41:43 PM
You don't need to convert, just use a char:
Code:

char c = 65;
printf("c = %c\n", c);

Will print:
Code:

c = A


Title: CHR$() equivalent in C
Post by: Skyler on April 24, 2007, 08:07:43 PM
Can I do that with strcat? I'm trying to make a string to print to the system with system().


Title: CHR$() equivalent in C
Post by: LooseCaboose on April 25, 2007, 05:20:33 AM
You may be better using sprintf, or if you are using Linux and don't mind your code being unportable you can use asprintf.


Title: CHR$() equivalent in C
Post by: Skyler on April 25, 2007, 07:30:53 AM
Actually it's Knoppix. And it's someone else's system, but we won't g there right now....