#include <stdio.h>
#include <stdlib.h>
#define N 5
void main(void)
{
char* c;
c=(char*)malloc(sizeof(char));
char* string;
string=(char*)malloc(sizeof(char)*(N+1));
char *wfileinput = (char*)calloc(20, sizeof(char));
char *wfileoutput = (char*)calloc(20, sizeof(char));
FILE *fileinput;
FILE *fileoutput;
printf("put' vh. faila ");
scanf("%s", wfileinput);
printf("put' rez. faila ");
scanf("%s", wfileoutput);
fileinput = fopen(wfileinput, "rt");
if(fileinput==NULL)
{
printf("File is not found!\n");
exit(0);
}
fileoutput = fopen(wfileoutput, "wt");
if(fileoutput==NULL)
{
printf("File is not found!\n");
exit(0);
}
while(*c != EOF)
{
fgets(string, N + 1, fileinput);
fputs(string, fileoutput);
fputc('\n', fileoutput);
while (*c != '\n' && *c != EOF)
*c = fgetc(fileinput);
if (*c != EOF)
*c = ' ';
}
free(wfileinput);
free(wfileoutput);
free(c);
free(string);
}
while(*c != EOF)
{
*c = fgetc(fileinput);
if (*c == '4')
{
break;
}
fseek(fileinput,0,SEEK_SET);
if(*c == '4')
{
// определение длины файла
fseek(fileinput,0,SEEK_END);
len=ftell(fileinput);
fseek(fileinput,0,SEEK_SET);
fgets(string, len+1, fileinput);
fputs(string, fileoutput);
}
else
{
Ваш предыдущий код
}
Если Вы уже зарегистрированы на Портале - войдите в систему, если Вы еще не регистрировались - пройдите простую процедуру регистрации.