0
(c language) mistakes "FILE" and "structures"
this code receive user name & password for 6 users but there is mistakes i dont know what are they https://code.sololearn.com/cLU5uHronU06/#c
9 Antworten
+ 5
U haven't specified the return type for main()
that is, write int main() and then return 0 at the end.
+ 1
The gets() function has a security vulnerability( buffer overflow), so it is preferable to use fgets() instead because it requires a second parameter which is the size of the buffer you wanted to store data in it.
Additionally, you should remove the = sign between fputs and the parentheses '()'.
Finally you need to specify the return type of your main function.
0
Alphin K Sajan
QTWizard
Still not work
error: too few arguments to function 'fgets'
0
You need to enter 12 lines like:
Name0
Pass0
Name1
Pass1
Name2
Pass2
And so on. That is because sololearn doesn't use an interactive IDE.
If you are using fgets, you need to specify the size of the buffer.
0
QTWizard
I want to do it with structures
0
saso yoo yeah i see, please follow my instructions in order to make your program works.
0
QTWizard
I just found where is the problem
I forgot to put "w" in
fout=fopen("D:\mext.txt,"w");
Thanks everyone 🌹
why when I use fgets it is said
error: too few arguments to function 'fgets'
0
it says no out put
i fixed the code as told you
but when i use fgets it says
error: too few arguments to function 'fgets'