+ 1
Help with a c code to input data to new txt file
ok so I just finished the c course and want to practice my knowledge so I tried to make a program to get input from a user and create a new file and write those inputs to the file ... the "email" part doesn't take input and of course, the whole program doesn't return 0. so I need help to fix it and pardon my mistakes because I am a total amateur and thanks for the help in advance. code : https://code.sololearn.com/cP3SzdlWjy9x/#c
6 Respostas
+ 3
Use scanf instead of gets for each data input just remplace gets with scanf .Then as you use new_data.name in the fprintf do the some for other structure elements age occupation and email.no need to use pointer dptr.
+ 4
You have to declare the structure outside main.
+ 3
What kind of error your compiler gives you?
+ 2
This my try in your code here welcome https://code.sololearn.com/ciyGl31R9HzL/?ref=app
+ 1
it worked perfectly, thanks a lot ^^
0
ok, I declared it outside the main - sorry for that mistake - but the program still has the same problems...