Solve Visual Studio Not Finding Downloaded File

  • Thread starter Thread starter andryd9
  • Start date Start date
  • Tags Tags
    Programming
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
6 replies · 2K views
andryd9
Messages
51
Reaction score
2

Homework Statement



I am trying to write a program in Visual Studio that opens a file downloaded to my computer. I have downloaded the file but Visual Studio can't seem to find it. Anyone know what I need to do?

TIA!

Homework Equations





The Attempt at a Solution

 
Physics news on Phys.org
andryd9 said:

Homework Statement



I am trying to write a program in Visual Studio that opens a file downloaded to my computer. I have downloaded the file but Visual Studio can't seem to find it. Anyone know what I need to do?
By defualt, Visual Studio looks in the directory where it puts the executable for your program. If the file you're looking for isn't there, VS won't find it. You'll probably need to include the full path to your file in your VS program.

BTW what language is your program in? Visual Studio isn't a language.
 
Hi Mark44,
Thanks for your reply. I am aware that Visual Studio is not a language :) I am coding in C++. How does one include the full path to a file, anyway?
 
void(main)
{
ifstream inFile;
inFile.open("PORTLAND-ME.txt");
inFile>>year>>month>>day>>etc, etc
}

Nothing profound. This file exists in my computer as named. Not sure why VS can't find it.

}
 
Open the folder containing your project. Drop the text file in there. You're done.
Alternatively you can just use "something/somethingelse/somethingelseagain/file.txt"

You'll have to figure out the something's, but I hope that won't be too hard.

VS isn't going to do a search of the entire computer to find your file, you'll need to actually tell it where's it at.
 
Last edited:
  • Like
Likes   Reactions: 1 person
Like Student100 said, you'll have to either put the file in the default directory for the application, or include the full path, which will need to include the drive letter, like this: "c:\..."
 
  • Like
Likes   Reactions: 1 person