www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/26/02:57:09

From: "gimli" <gimli21 AT mediaone DOT net>
Newsgroups: comp.os.msdos.djgpp
References: <760iv9$dlk$1 AT cubacola DOT tninet DOT se>
Subject: Re: ***Conversion Question***
Lines: 29
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Message-ID: <tg0h2.2811$jd2.6925470@rmnws01.ce.mediaone.net>
Date: Sat, 26 Dec 1998 01:23:52 -0600
NNTP-Posting-Host: 24.131.165.225
X-Trace: rmnws01.ce.mediaone.net 914657433 24.131.165.225 (Sat, 26 Dec 1998 01:30:33 CDT)
NNTP-Posting-Date: Sat, 26 Dec 1998 01:30:33 CDT
Organization: MediaOne Express -=- Central Region
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Börje Granberg wrote in message <760iv9$dlk$1 AT cubacola DOT tninet DOT se>...
>I have problem with my ex of DJGPP:
>I've been working with DJGPP at home for about 4-5 month and now I have
>come to the problem that I dont know how to convert a INT to at CHAR*.
>I want the INT I to become a string so I can add a number, let's say '123'
>to
>the string "Look on page " so it will be "Look on page 123".
>
>

...

char str[256];
int i = 123;

...

sprintf (str, "Look on page %d", i);
printf ("%s", str);

...

This prints a format string into the memory str points to (must be a valid
char* location).  You can then print out the string like normal.

Merry Christmas


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019