this is just a quick question should be easy... but if im opening a file to be read in like input.txt where do i put the input.txt file?
this is just a quick question should be easy... but if im opening a file to be read in like input.txt where do i put the input.txt file?
You put it in the same directory as your executable. Should be fine in most of the cases, except if you are drog and drapping file on your executable (in Windows) where you'll now need the complete path (ex. "C:/a_folder/my_file.txt") to reach the correct file....
worked great thanks i thought thats where it needed to go but for some odd reason it wasnt working fiddled with it now it does thanks!
Actually, you don't have to put it in the same directory. You're supposed to give it the full path. But if fopen does only finds a file name with no path, then it searches it's current directory.
e.g. If the file called text.txt and is placed in C:\ you can either open it withNote that '\\' is needed since \ is used as an escape sequence.Code:fopen("C:\\text.txt", "r");
OR you can place the file in C:\ and run it withHope I helpedCode:fopen("text.txt", "r");