Link to home
Start Free TrialLog in
Avatar of cuong5985
cuong5985

asked on

ask

can i ask someone what is external file name for I/O Stream???
Avatar of Axter
Axter
Flag of United States of America image

Hi cuong5985,
> >can i ask someone what is external file name for I/O Stream???

What do you mean by external file name?

David Maisonave :-)
Cheers!
Avatar of cuong5985
cuong5985

ASKER

Just like i have a program like this:
#include <fstream>
#include <iostream.h>
#include <stdlib.h>

int main()
{
using namespace std;
ifstream in_stream;
ofstream out_stream;

in_stream.open("infile.dat");
out_stream.open("outfile.dat");

int first, second, third;
in_stream >> first >> second>> third;
out_stream <<"The sum of the first 3\n"
           <<"numbers in infile.dat\n"
           <<"is" <<(first+second+third)
           <<endl;
in_stream.close( );
out_stream.close( );

      system("PAUSE");
      return 0;
}

So where is my infile.dat located????
>>So where is my infile.dat located????

This depends no your implementation, OS, and IDE.

If you want to be sure of it's location, you should give it a fully qualified name (full path).

Without a fully qualified name, it could be located in one of the follownig directories:
The path of your executable
The path were you launched your executable
The path of your current directory when file is opened

FYI:
You should not use ifstream.h and iostream.h
They're not part of the C++ standard, and therefore they're not portable and will not compile on compilers like VC++ 7.x

Use <iostream> and <fstream> instead, which are part of the C++ standard.
have u wriiten the program ur self or gotten it from somewhere
ASKER CERTIFIED SOLUTION
Avatar of furqanchandio
furqanchandio

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I just want to give an example and get that example from a book.  THanks for your comment.