Answers for "Here is a program in C that illustrates the use of fscanf() to read a text file:"

0

Here is a program in C that illustrates the use of fscanf() to read a text file:

#include <stdio.h>
#include <stdlib.h>
int main()
{

printf("Welcome to DataFlair tutorials!\n\n");

char character;
FILE *fpointer;

if ((fpointer = fopen("C:\\program.txt","r")) == NULL)
{
printf("Error! The file does not exist.");
exit(0);
}
fscanf(fpointer,"%c", &character);
printf("The character is: %c", character);
fclose(fpointer);
return 0;
}
Posted by: Guest on April-02-2022

Code answers related to "Here is a program in C that illustrates the use of fscanf() to read a text file:"

Browse Popular Code Answers by Language