Here is my code but I don't know why it prints only some part of lines. here is my code:
#include<stdio.h>
#include<sys/types.h>
#include<fcntl.h>
int main(int argc,char *argv[])
{
    FILE *fpr,*fpw;
    int cnt=0;
    fpw=fopen(argv[2],"w+");
    char buff[1000];
    while((fpr=fopen(argv[1],"r"))==NULL)
    {
        printf("\nCan't open file %s\n",argv[1]);
        scanf("re-enter file name:%s\n",argv[1]);
    }
    
    while (!feof(fpr))
    {
        
        fgets(buff,2,fpr);
        if(buff[0]=='\n')
        {
            putc(buff[0],fpw);
            fseek(fpw,0,SEEK_SET);
        
        }
        fputs(buff,fpw);
        cnt++;
    }
    
    fclose(fpr);
    fclose(fpw);
    
}
INPUT FILE:
Hrey yhis will print twicw
lets print thrice
@why not
OUTPUT FILE
lets print thrice @why not
