it gives me this error but I dont know why since I used "string" variables not "char*"
"Dell-DV051:~$ g++ -o io console.cpp
console.cpp: In function ‘int main()’:
console.cpp:38:34: error: cannot convert ‘const char*’ to ‘FILE* {aka _IO_FILE*}’ for argument ‘1’ to ‘int fscanf(FILE*, const char*, ...)’
noah@noah-Dell-DV051:~$ g++ -o io console.cpp
console.cpp: In function ‘int main()’:
console.cpp:38:34: error: cannot convert ‘const char*’ to ‘FILE* {aka _IO_FILE*}’ for argument ‘1’ to ‘int fscanf(FILE*, const char*, ...)’"
fscanf is the c way of reading a file. You wanted to use scanf which reads from the keyboard/standard input.
It is also not a wise idea to mix c and c++. Both Languages have file io structures to be used with them. They also have equivalent structures on things to get things done in either text or binary files.
Also learn to use [ code ] and [ /code ] code tags like I have around fscan
Unless you are trying to write out to the file with that line, which would fprintf
thanks I'm new here, yeah first I read a "C for dummies" then "C++ for dummies" guess that gave me bad habits, what would you suggest I use as an alternative to fscan like cin? from what I understood you could not have multiple variables read from it