fprintf



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.


Parameters

ParameterDescription
fileStreamPointer to a FILE object that identified by the stream.
strFormatThe string format that contains the text to be written to the stream. The format string is composed of zero or more directives
Returns

on successful, these function return the number of characters printed (not includes the trailing '\0' used to end output to strings).

example program
#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;
}
output

filename.txt - file contains
data writing to file | (fprintf_prg.c|main|15)



strtok

Split string into tokens

posted on 2019-03-17 20:41:48 - C Programming Language Tutorials


zalloc

zalloc is a third party library

posted on 2018-12-12 20:46:30 - C Programming Language Tutorials


math

posted on 2017-12-29 22:52:47 - C Programming Language Tutorials


Prompt Examples

ChatGPT Prompt Examples

posted on 2023-06-21 22:37:19 - ChatGPT Tutorials


Use Cases

Chat GPT Key Use Cases

posted on 2023-06-21 21:03:17 - ChatGPT Tutorials


Prompt Frameworks

Prompt Frameworks

posted on 2023-06-21 19:33:06 - ChatGPT Tutorials