Qbasicnews.com
April 22, 2018, 07:36:02 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: CHR$() equivalent in C  (Read 6104 times)
Skyler
Ancient Guru
****
Posts: 564



« 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.
Logged

In the beginning, there is darkness the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor
LooseCaboose
I hold this place together
*****
Posts: 981



« Reply #1 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
Logged

esus saves.... Passes to Moses, shoots, he scores!
Skyler
Ancient Guru
****
Posts: 564



« Reply #2 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().
Logged

In the beginning, there is darkness the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor
LooseCaboose
I hold this place together
*****
Posts: 981



« Reply #3 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.
Logged

esus saves.... Passes to Moses, shoots, he scores!
Skyler
Ancient Guru
****
Posts: 564



« Reply #4 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....
Logged

In the beginning, there is darkness the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!