
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>fputs() write a string to stream</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
fputs() Write a String to Stream
#include <stdio.h>
int fputs(string,stream);
const char *string; String to be output
FILE *stream; Pointer to file structure
fputs() copies 'string' to the output 'stream' at the current
position. The terminating null character ('\0') is not copied, and
the function does not append a new-line character.
Returns: The last character output, if successful. If the
input string is empty, zero is returned. A return
value of EOF indicates an error.
-------------------------------- Example ---------------------------------
The following statements open a file, seek the end of the file and
write a string to it.
#include <stdio.h>
FILE *stream;
main()
{
if ((stream = fopen("book.dat","w+")) != NULL) {
fseek(stream,0L,SEEK_END);
fputs("End of Chapter 10\n", stream);
}
}
See Also: fgets() gets() puts()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson