Professional Documents
Culture Documents
23CHI077
23CHI077
23CHI077
NAME:PAGHADAR PREM
Course Code and Name: 2CS101, Computer Science
Practical No : 10-a
Aim : To calculate length of a file
Methodology :
#include <stdio.h>
int main()
{
FILE *fp;
long int size=0;
fp=fopen("temp.txt","r");
fseek(fp,0,SEEK_END);
size=ftell(fp);
if(size!=-1)
printf("File size is: %ld\n",size);
else
printf("There is some ERROR.\n");
return 0;
}
char arr[40];
fscanf(fl, "%s", &arr);
fprintf(fp, "%s", arr);
}
Theoretical concepts: file handling
Input and Output:
Practical No : 10-c
Aim : To copy the content of one file to another
Methodology :
#include <stdio.h>
void main()
{
FILE *fp;
FILE *fl;
fp=fopen("temp.txt","w");
fl=fopen("temp1.txt", "r");
char arr[40];
fscanf(fl, "%s", &arr);
fprintf(fp, "%s", arr);
}
Theoretical concepts: file handling
Input and Output:
Conclusion :
We performed this experiment by successfully using file handling.