Here My text file which includes ips :
168.897.61.23
168.32.74.11
127.0.0.1
127.0.0.1
here my bad code (sorry i'm newbie) :
#include <stdio.h>
int main(){
FILE *fptr1;
char file1[] ="test.txt";
char curr;
int del, line_number = 0;
filet = fopen(file1,"r+");
curr = getc(filet);
if(curr!=EOF) {line_number =1;}
while(1){
if(del != line_number)
putc(curr, filet);
curr = getc(filet);
if(curr =='\n') line_number++;
if(curr == EOF) break;
}
fclose(filet);
}
I want working code to output my file like this :
168.897.61.23
168.32.74.11
127.0.0.1
Thanks.