Search
 
SCRIPT & CODE EXAMPLE
 

C

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

#include <stdio.h>
#include <stdlib.h>

int main()
{

printf("Welcome to DataFlair tutorials!

");

char character;
FILE *fpointer;
fpointer = fopen("C:program.txt","w"); // Here "w" refers to write on file
if(fpointer == NULL)
{
printf("Error! The file does not exist.");
exit(0);
}
printf("Enter a character: ");
scanf("%c",&character);

fprintf(fpointer,"%c",character); // Use of fprintf() function
fclose(fpointer);

return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: Highest integer among the four inputs in c 
C :: spacemacs start server 
C :: C static libraries (Indexing an archive) 
C :: como somar em C 
C :: print char* address C 
C :: ansi c function array of strings parameter 
C :: ansi c write unsigned short to file 
C :: onvert a string into 2d string in c 
C :: Combine two sentences into one langage c 
C :: C Assigning addresses to Pointers 
C :: creation of a thread 
C :: translator program in c 
C :: cmake boilerplate for visual studio c++ project 
C :: arcolinux 
C :: convert char to int ascii in c function 
C :: uri/beecrowd problem no - 1133 solution in C 
C :: peripheral bus clock pic32 
C :: shortest job first 
C :: Example of header file c 
C :: passage on dowry 
C :: batteries included 
C :: c static variable 
C :: programmation c 
C :: c variable 
C :: calendar in c 
Dart :: list item bottom border in flutter 
Dart :: flutter textfield label align top 
Dart :: dart round to 2 decimals 
Dart :: remove space from string dart 
Dart :: flutter close dialog 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =