Files
2024-08-31 12:07:21 +03:00

30 lines
621 B
C

#include<stdio.h>
int main(){
FILE *fp;
char ch;
int length;
fp = fopen("homework.txt","r+");
if(fp == NULL){
printf("File does not exist!");
return -1;
}
while((ch = fgetc(fp)) != EOF){
if(ch >= '0' && ch <= '9'){
length++;
}
else if(ch == ' ' && length!=0){
fseek(fp,ftell(fp)-length,SEEK_SET);
fputc('|',fp);
while(length>0){
fputc('s',fp);
length--;
}
}
else
{
length=0;
}
}
fclose(fp);
return 0;
}