[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
fputs

Write a character array to a stream.
Compatibility:
This function is compatible with the following targets:
Prototype:
#include <stdio.h>
int fputs(const char *s, FILE *stream);
Parameters:
Parameters for this facility are:
Remarks:
The fputs() function writes the array pointed to by s to stream and advances the file position indicator. The function writes all characters in s up to, but not including, the terminating null character. Unlike puts(), fputs() does not terminate the output of s with a newline ('\n').
If the file is opened in update mode (+) the file cannot be written to and then read from unless the write operation and read operation are separated by an operation that flushes the stream's buffer. This can be done with the fflush() function or one of the file positioning operations (fseek(), fsetpos(), or rewind()).
NOTE
On embedded/ RTOS systems this function only is implemented for stdin, stdout and stderr files.
Return:
fputs() returns a zero if successful, and returns a nonzero value when it fails.
See Also:
"Wide Character and Byte Character Stream Orientation"
"puts"
Example of fputs() usage.:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *f;
// create a new file for output
if (( f = fopen("foofoo", "w")) == NULL) {
printf("Can't create file.\n");
exit(1);
}
// output character strings to the file
fputs("undo\n", f);
fputs("copy\n", f);
fputs("cut\n", f);
fputs("rickshaw\n", f);
// close the file
fclose(f);
return 0;
}
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000