Skip to main content
gamedev.net
🔒 Locked

Need Help

Started by Znabty Sep 21, 2005 at 4:10 AM 6 replies 700+ views
Original Post
Znabty
Znabty
well i dont know how to open a file from a other destination. like the tool is on C:\ but the file that the tool should edit is on D: so what is the command to go to D:\ and edit the file while the tool is in C: Sry iam new in C++ and i dont know this one hope you understand what i mean -Thank you
Illco
Illco
You can open a file from anywhere (local) using its precise path i.e.:
D:\SomeDir\SomeFilename.txtC:\SomeOtherDir\SomeOtherFilename.txt


If you need to know file I/O in C++ search for tutorials on it using Google. Note also that in literal strings in C/C++ you need to write double backslashes -- as an example of opening the previous file using C I/O:
fp = fopen( "D:\\SomeDir\\SomeFilename.txt", "rt" );


Good luck,

Illco
Znabty
Znabty
Thank you Very Much :)

you made me really happy :)
benryves
benryves
As an aside, rather than use double-backslashes you could just use single forward slashes, so
fp = fopen( "D:/SomeDir/SomeFilename.txt", "rt" );
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]
Znabty
Znabty
i see but wich header file should be included?
Peregrin
Peregrin
Using paths does not require any header.
fopen requires (if you are using C) or (for C++).
Jooleem. Get addicted.
Ced1
Ced1
EDIT: I was beat ^

for 'fopen' include

I got my username back, no more Clockwise :D *dances*
Znabty
Znabty
thank you :)

it works now :D

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.