0

W1hat wrong here

https://code.sololearn.com/ca20a19a25A1 cannot correctly to out the name, designation, category, location

19th Feb 2021, 4:00 PM
^-^
3 Antworten
+ 4
There are several problems in your code :- 1) while reading the files you are passing reference to the pointer pointing to arrays instead of array itself making the compiler think that you are passing an array of pointers ( pass the array mane directly to fix ) 2) if you file doesn't exist on the system (which it will not on SL's system) so the file pointer will return NULL which even after your if statement will be attempted to be closed at the end making the runtime error to occur ( to fix it just stop the execution inside the if statement only and if you want return required exit code for error handling ) Here is the fix https://code.sololearn.com/c9iQvv5Zt3nt/?ref=app
19th Feb 2021, 4:39 PM
Arsenic
Arsenic - avatar
0
Also as a side note : #pragma warning (disable: 4996) Will only work for MSVC compiler and as SL uses gcc this will give additional warning when used.
19th Feb 2021, 4:48 PM
Arsenic
Arsenic - avatar
0
i used the visual studio so need the #pragma warning (disable: 4996), and the file is exist, now it cannot stop the loop when i run
19th Feb 2021, 4:53 PM
^-^