[Solved] Program fails to open file


In string literals, the “\” slash is the escape character. In order for your string literal to work properly you need to escape each “\” with the “\”. In other words, replace each “\” with two slashes like so:

inFile.open("C:\\Users\\Muhammad Shaeel\\Desktop\\CC\\Lexical Analyser Code\\Lexical Analyser Code\\program.txt");

solved Program fails to open file