You are on page 1of 2

KNAS SIR ASSAIGNMENT 1 (MARKS - 60)

#include <stdio.h>
#include <stdlib.h>
//#include <alloc.h>

int main()
{
char name[20];
int regno;
int rollno;
char fathername[20];

FILE *ptr;
char ch;
ptr = fopen("D:\\AnikChowdhury","a");

/*do{
ch = fgetc(ptr);
print("%c",ch);
}while(ch!=EOF);*/

printf("Enter the Name \n");


gets(name);
fprintf(ptr,"Name = %s \n",name);

printf("Enter the Reg No \n");


scanf("%d",&regno);
fprintf(ptr,"Reg No = %d\n",regno);

printf("Enter the Roll No \n");


scanf("%d",&rollno);
fprintf(ptr,"Roll No = %d\n",rollno);

printf("Enter the Father Name \n");


gets(fathername);
fprintf(ptr,"Father Name = %s\n",fathername);

do{
scanf("%c",&ch);
fprintf(ptr,"%c",ch);
}while(ch!='.');
fclose(ptr);

ptr = fopen("D:\\AnikChowdhury","r");
for(int i;ch!=EOF;i++){
ch=fgetc(ptr);
}
fclose(ptr);
return 0;
}

You might also like