View Full Version : how do i do this in C++?
Bmxpunk86pl
11-06-01, 01:09 PM
say if i wanted to write a program in C++ that takes a file from a cd and installs it to a special directory, how would i declare that to happen would i do this:
int f:\XXX;
do you understand me?
Thelemac
11-07-01, 01:59 AM
Uh..something with ostream = "c:\special\directory" or something like that, I think. I know you can set the directory...I just haven't ever used that particular option.
Bmxpunk86pl
11-07-01, 01:49 PM
no i dont want it in the #include thing. i want it in the body of the program. say i wanted to write a program that would delete a file from a harddrive, how would i make C++ look for that file and then do something with it?
Thelemac
11-07-01, 04:17 PM
You set either the istream or the ostream to look in that particular directory...that isn't done in the header at all. Here is a little bit of example code for it:
#include fstream;
ifstream = "C:\your\directory\file.name"; // This can be done in main(), too
ofstream = "F:\your\directory\file.name"; // This can be done in main(), too
Not sure of the exact syntax, but that's basically how you do it (got just a little bit confused on the difference between iostream and f stream before...)
Superman53142
11-07-01, 09:03 PM
It's iostream.h
And I haven't screwed with it that much but Shadow's looks pretty good.
Thelemac
11-08-01, 01:15 AM
Originally posted by Superman53142
It's iostream.h
And I haven't screwed with it that much but Shadow's looks pretty good.
Like I said..it's been a while.
And what's with everybody thinking I'm Shadow рс lately?
ButcherUK
11-08-01, 09:42 AM
it's #include <fstream> (you need <> or "", no ; ), and it's ifstream cdfile; cdfile.open("F:\blah\blah.txt"); etc.
Thelemac
11-09-01, 08:38 AM
Originally posted by ButcherUK
it's #include <fstream> (you need <> or "", no ; ), and it's ifstream cdfile; cdfile.open("F:\blah\blah.txt"); etc.
Yeah, that's it. :)
I knew that my syntax was messed up a bit. Been so long since I've used it...
Zuck Gou :)
11-15-01, 01:08 AM
Originally posted by Thelemac
Like I said..it's been a while.
And what's with everybody thinking I'm Shadow рс lately?
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.