home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.disi.unige.it
/
2015-02-11.ftp.disi.unige.it.tar
/
ftp.disi.unige.it
/
pub
/
.person
/
CataniaB
/
teach-act
/
esempi
/
File
/
mix.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-04
|
363b
|
25 lines
#include <stdio.h>
/* Leggo due file carattere x carattere e li mischio assieme */
main()
{
FILE *in1,*in2,*out;
FILE *cur;
int c,N;
in1=fopen("f1","r");
in2=fopen("f2","r");
out=fopen("output","w");
cur=in1;
while ((c=fgetc(cur))!=EOF)
if (c=='*') cur=(cur==in1)?in2:in1;
else fputc(c,out);
fclose(in1);
fclose(in2);
fclose(out);
}