C Programming Language |
malloc |
calloc |
memset |
memcpy |
memory |
strcpy |
string |
strtok |
isalnum |
cctype |
errno |
cfenv |
clock |
difftime |
mktime |
ctime |
fprintf |
fscanf |
printf |
scanf |
stdio |
math |
defined in header file stdio.h
int fprintf( FILE * fileStream, const char * strFormat, ...);
The fprintf function sends formatted out put to stream, pointed by fileStream.
Parameter | Description |
---|---|
fileStream | Pointer to a FILE object that identified by the stream. |
strFormat | The string format that contains the text to be written to the stream. The format string is composed of zero or more directives |
on successful, these function return the number of characters printed (not includes the trailing '\0' used to end output to strings).
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* memset */
// gcc -o fprintf_prg fprintf_prg.c
// ./fprintf_prg
int main ()
{
printf("started program %s-%d\n", __FUNCTION__, __LINE__);
FILE * filePointer;
filePointer = fopen ( "filename.txt", "w+");
fprintf( filePointer, "%s | (%s|%s|%d)", "data writing to file", __FILE__, __FUNCTION__, __LINE__);
fclose( filePointer);
return EXIT_SUCCESS;
}
filename.txt - file contains
data writing to file | (fprintf_prg.c|main|15)
zalloc is a third party library
posted on 2018-12-12 20:46:30 - C Programming Language Tutorials
posted on 2017-12-29 22:52:47 - C Programming Language Tutorials