I am trying to read lines from a text file whose name is passed as a command line argument. I have tried numerous things but have been yet been able to get the file open. I have no compiler issues. The file that I am trying to open is called words.txt and is in the same directory as the cpp. My code is below, thanks for any help.
Are you actually passing it as an argument? Also, if the user doesn't input an argument you will be accessing invalid data, so check argc beforehand. Other then that...I don't see anything that's wrong...
the words.txt file is in the same directory and spelled exactly as is in the code, also the executable is current. I have no idea why it won't work because it doesn't seem that complex.