i want to print a space in a text file .wat i have opted so far is
fprintf (stream,"%c",32),
but i am not getting the result,am i wrong or is there anyother way,remember i want to print with fprintf option only.
i want to print a space in a text file .wat i have opted so far is
fprintf (stream,"%c",32),
but i am not getting the result,am i wrong or is there anyother way,remember i want to print with fprintf option only.
Code:fprintf (stream,"%c",' ')
--Code:fputc(' ', stream);
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Well, since this is the C++ board:
orCode:stream << ' ';
orCode:stream.put(' ');
...assuming stream is some ostream derived object.Code:stream.write(" ",1);
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
@matsp, hk_mp5kpdw he said use fprintf only.
fprintf(stream, " ");
:/
You know, whitespace is invisible... better put your spectacles on and make sure the cursor didn't move before you panic.
If you insist on using fprintf then you need to make sure your stream is a FILE* and use C's file funtions (like fopen() and fclose()) with the stream. Look at C tutotials or file IO to learn more.
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.
If you want to print to the screen, use stdout for the filestream. Or just use printf(s,...), which is the same as fprintf(stdout,s,...).
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.