I am having trouble successfully opening a text file located in the same directory as the program in Windows using Visual Studio 2019. Is there a dependency for Visual Studio or Windows in the format that the text file location has to be specified? Or is there some other aspect that I am not taking into account?
If you're running the program through the IDE's debugger, you need to set the working directory properly. Right click on the project in the Solution Explorer, click Properties, Debugging section, and set Working Directory to $(OutDir)
The working directory can be different depending on whether you are running your app through the VS IDE or from the directory where your .exe file resides.
Via the IDE the working directory is where your source file(s) are located.