A question for the C wizards... ;-) (fwd)_(re)

Wed, 28 May 1997 20:04:02 -0400 (EDT)



Here's the answer I got from one of my C wizard friend... :-)

Pierre Phaneuf

"The use of COBOL cripples the mind; its teaching should, therefore, be
regarded as a criminal offense." - Edsger W. Dijkstra.

---------- Forwarded message ----------
Wed, 28 May 1997 17:00:03 -0400
stephane.lajoie@belairdirect.com
To: pierre@tycho.com
Cc: grendel@hoth.amu.edu.pl
A question for the C wizards... ;-)_(re) 

itoa is in stdlib.h/libc.a for DJGPP. I thought it was ANSI C...? Anyway, I
would suggest sprintf like this:

  sprintf(buf, "%i", i);

Where buf is a pre-allocated buffer big enough for a decimal representation
of an int and i is the value to convert. You loose the radix parameter,
though.

extern int _fmode is a DOS thing. If the value is O_TEXT, carriage return
(0x0D) characters will be stripped on reads and added on writes as needed.
Simply comment out all references to _fmode, O_TEXT and O_BINARY if
__DOS__(or whatever) is not defined. The 'b' you might see in the mode
string of fopen calls (ex: fopen("BobTheFile", "rb"); )is the same: simply
remove it when not in DOS.



stephane.lajoie@belairdirect.com (stephane.lajoie@belairdirect.com)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es