#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <errno.h>
int main(void)
{
int n ;
char c;
FILE *f_output_int,
*f_output_ch;
if( f_output_ch=fopen("ch.txt","wt") == NULL)
{
perror("Невозможно открыть файл");
getch();
exit(1);
}
if( f_output_int=fopen("int.txt","wt") == NULL)
{
perror("Ошибка");
getch();
exit(1);
}
while(1==1)
{
c=getc();
if( c=='0' || c=='1' || c=='2' || c=='3' || c=='4' || c=='5' || c=='6' || c=='6' || c=='7' || c=='8' || c=='9' )
fputc(f_output_int,"%s",c); //посимвольно в файл c цыфрами пишем
else fputc(f_output_ch,"%s",c);//посимвольно в файл с симвалами пишем
if (c=='\n') break;//если "пустой" символ выходим
}
fclose(f_output_int);//закрываем файл
fclose(f_output_ch);//закрываем файл
getch();
return 0;
}
|