PDA

View Full Version : how do i do this in C++...?


Bmxpunk86pl
12-29-01, 07:46 PM
How would i make c++ look for a file on a hard drive and then say delete it or make a copy of it or open it.

would i do this


int main()
{
int c:\whatever;
}
return 0;

XprincoX
12-30-01, 02:17 AM
well depending on it your writing ur methods in a class. But it would something like this:


#include <fstream>
#include <iostream>

void main()
{
int data;
ifstream in_file;

in_file.open("myfile");
in_file >> data;

while(!in_file.eof())
{
cout<<data<<endl;
in_file>>data;
}

in_file.close();
}

Heres a nice site with some more info:
http://www.cplusplus.com/doc/tutorial/tut6-1.html

Vovan
12-30-01, 04:23 AM
Well, I am fully in asm now, but i suggest that you look for the description of a nice and speedy function dosfindfirst(), dosfindnext() or there equals , depending on the realization, if you want to find ANY file ANYWHERE.

Bmxpunk86pl
12-30-01, 08:07 AM
Ok thanks a lot you guys.