Re: [Dev-C++] Problem with Writefile
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Anton T. <ant...@ch...> - 2001-09-01 08:18:13
|
hi, there are several ways to convert an integer to a string, for example char s[80]; int i; i = 123; sprintf(s, "the value of i is: %d\n", i); this copies the text "the value .." to s, and then replaces the "%d" with a string representing i. if you want only the integer to appear in the string, you can remove the rest of the so-called format string and just write sprintf(s, "%d", i) s should be "123", then. you may also concatenate more than one argument: sprintf(s, "i: %d; j: %d", i, j); bye, anti. ----- Original Message ----- From: JS <jsc...@gm...> To: <dev...@li...> Sent: Friday, August 31, 2001 5:22 PM Subject: [Dev-C++] Problem with Writefile > > Hello, i am using the writefile to place strings into a textfile from a > consol app ! > > The following works normally > > char *pstr; > pstr = "Prozess - Protokoll \n "; > WriteFile(hfile, pstr, 25, &dwWritten, NULL); > > And I also can write value of e.g. "int a" by > > WriteFile(hfile, &a, 1, &dwWritten, NULL); > > > But it appears as one byte only - unreadable in text browser. > > Now, how can I write it in ASCII - ? > > How CAN I convert an e.g. integer to a string ? > > I remember from DOS Programming, there was a function. > > thanks for a hint > > j.s. > > > > > > ---------------- > J.Schuhmacher > jsc...@gm... > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |