Qbasicnews.com
CHR$() equivalent in C - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: General (http://qbasicnews.com/newforum/forum-6.html)
+--- Forum: General/Misc (http://qbasicnews.com/newforum/forum-18.html)
+---- Forum: General Programming (http://qbasicnews.com/newforum/forum-20.html)
+---- Thread: CHR$() equivalent in C (/thread-9968.html)



CHR$() equivalent in C - Skyler - 04-24-2007

What is it? I'm trying to write a program which adds some specific ascii codes to a string.


CHR$() equivalent in C - LooseCaboose - 04-25-2007

You don't need to convert, just use a char:
Code:
char c = 65;
printf("c = %c\n", c);
Will print:
Code:
c = A



CHR$() equivalent in C - Skyler - 04-25-2007

Can I do that with strcat? I'm trying to make a string to print to the system with system().


CHR$() equivalent in C - LooseCaboose - 04-25-2007

You may be better using sprintf, or if you are using Linux and don't mind your code being unportable you can use asprintf.


CHR$() equivalent in C - Skyler - 04-25-2007

Actually it's Knoppix. And it's someone else's system, but we won't g there right now....