+ 1
Hey how can fix this....the code runs well but it skips the user input
6 Respostas
+ 4
Link your code......Gakuru!
So you can get help.
+ 4
Don't put your code into the thread's tags please. Use tags to specify context and to define language and/or subject specifics 👍
+ 3
Thanks alot for your help I was able to fix it
+ 1
May you post the code?
+ 1
#include <stdio.h>
#include <stdlib.h>
int main() {
char word[100];
FILE *fptr;
char filename[8];
int choice;
printf ("ENTER fILE NAME\n");
fgets(filename,8,stdin);
fptr= fopen(filename,"w");
if(fptr==NULL)
{
printf ("ERROR!");
exit(1);
}
printf ("ENTER CONTENT OF YOUR FILE\n");
scanf("%s",&word);
fprintf(fptr,"%s",word);
printf("want to the file\n");
printf("1.read file\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
if((fptr= fopen(filename,"r"))==NULL);
{
printf("file not found");
}
fscanf(fptr,"%s",word);
printf("%s",word);
}
return 0;
}