mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-15 03:12:35 +03:00
3e571bd7cc
git-svn-id: svn://kolibrios.org@6443 a494cfbc-eb01-0410-851d-a64ba20cac60
43 lines
609 B
C
43 lines
609 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
|
|
int i;
|
|
char c;
|
|
FILE *f;
|
|
FILE *fin;
|
|
FILE *fout;
|
|
|
|
//write to file
|
|
f=fopen("testfile.txt","w");
|
|
|
|
for(i=0;i<50;i++)
|
|
{
|
|
fputc('1',f);
|
|
}
|
|
fclose(f);
|
|
|
|
//append to file
|
|
f=fopen("testfile.txt","a");
|
|
|
|
for(i=0;i<50;i++)
|
|
{
|
|
fputc('2',f);
|
|
}
|
|
fclose(f);
|
|
|
|
//copy from testfile.txt to copyfile.txt
|
|
|
|
fin=fopen("testfile.txt","r");
|
|
fout=fopen("copyfile.txt","w");
|
|
|
|
while((c=fgetc(fin))!=EOF)
|
|
{
|
|
fputc(c,fout);
|
|
}
|
|
fclose(fin);
|
|
fclose(fout);
|
|
|
|
} |