Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fputs and boolean outputting

Status
Not open for further replies.

drrep

Programmer
Mar 13, 2002
47
US
Hi,

Just wanted to know if there was a way to use fputs to output a boolean value (1 or 0) to a file. I seem to be having trouble with that

Thanks in advance
 
hi,
fputs writes "null termianted string" on file
(as fprintf)

If you want use fputs, before you have to use a dummy string

char dummy[10];
sprintf( dummy, "%d", myboolval );
fputs( ... dummy ......) ;

or easier

fprintf( mystream, "%d", myboolval );

that's all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top