My code is below. The file I am trying to open is Random.txt located in "C:\Users\Tony\Downloads". I have tried inputting "Random.txt" "C:\\Users\\Tony\\Downloads\\Random.txt" "C:\Users\Tony\Downloads\Random.txt" and none of these are working, I keep getting my error message. Is there something wrong with the code or am I inputting the file name incorrectly?
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
"C:\\Users\\Tony\\Downloads\\Random.txt" or "C:/Users/Tony/Downloads/Random.txt" should work. Not sure if it makes a difference but try closing all programs that have the file opened.
"C:\\Users\\Tony\\Downloads\\Random.txt" should work. Two backslashes is better, because one backslash could be a comment like newline or other things.
Looking at your pictures... the computer that is compiling the program is not your computer. Therefore your input file does not exist on the computer that is doing the compiling.
On second thoughts... you should probably not use double backslashes (\\) when passing the arguments from the console window, but I'm not sure. You can also forward slashes instead (/).