28 lines
629 B
C
28 lines
629 B
C
|
#include "fileGestion.h"
|
||
|
|
||
|
void newFileCut(int cutLign, FILE *f){
|
||
|
char buffer[256];
|
||
|
for(int i = 0; i < cutLign; i++){
|
||
|
fgets(buffer , sizeof buffer , stdin);
|
||
|
//printf("Line contaigns: %s" , buffer);
|
||
|
}
|
||
|
while(1){
|
||
|
if(!fgets(buffer,sizeof buffer , stdin)) break;
|
||
|
fprintf(f,"%s",buffer);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void copyFile(FILE *f , FILE *g){
|
||
|
char buffer[256];
|
||
|
while(1){
|
||
|
if(!fgets(buffer , sizeof buffer , f)) break;
|
||
|
fprintf(g, "%s" , buffer);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void replaceFile(int nRow,FILE *g){
|
||
|
FILE *f = fopen("newFile.txt","a+");
|
||
|
newFileCut(nRow,f);
|
||
|
copyFile(f,g);
|
||
|
}
|