TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Jim Fitzsimmons
from: Gautam Lad
date: 1996-06-12 21:37:28
subject: Writing to Client.

Hi,
Yes, you can use variables.  You can use the C function sprintf();
which works like this: sprintf(string,buffer,type); 
Where string is where the buffer will be copied.
I think that's the format, but anyways you can try the following.

char string[11];            // String
char name[] = "Gautam Lad"; // Buffer of type char
int age = 16;               // Variable of type int
.
.
.
.

// The buffer name & age will be copied to string
sprintf(string,"Hello, my name is %s and I am %d years old.",name,age);

// Display the string
GpiCharStringAt(p_space,&coords,14,string);

Or, you can query the name and age from an entryfield, or another source.
the output would contain:

Hello, my name is Gautam Lad and I am 16 years old.

That's it.  sprintf(); will come handy when you want to combine variables
with strings.
Modify the code I gave you before with the one above. Experiment!  By the
way, view the file LIBREF.INF (comes with EMX/GCC) and it will give you
info. onhow to use sprintf(); function (and more).

Hope this helps!

--- Maximus/2 3.00
* Origin: One Less Car * TorontOS/2 * (416) 480-0147 * (1:250/238)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 517 628 713/888 800/1
@PATH: 250/238 2424/11 24 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.