Hey how can fix this....the code runs well but it skips the user input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hey how can fix this....the code runs well but it skips the user input

3rd Aug 2020, 10:22 PM
Gakuru Ian
5 Answers
+ 4
Link your code......Gakuru! So you can get help.
3rd Aug 2020, 10:27 PM
Rawley
Rawley - avatar
+ 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 👍
3rd Aug 2020, 11:16 PM
Ipang
+ 3
Thanks alot for your help I was able to fix it
4th Aug 2020, 12:32 PM
Gakuru Ian
+ 1
May you post the code?
3rd Aug 2020, 10:25 PM
Andy Chang
Andy Chang - avatar
+ 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; }
3rd Aug 2020, 10:26 PM
Gakuru Ian