Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

ask

can i ask someone what is external file name for I/O Stream???
0
cuong5985
Asked:
cuong5985
  • 2
  • 2
  • 2
1 Solution
 
AxterCommented:
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!
0
 
cuong5985Author Commented:
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????
0
 
AxterCommented:
>>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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
furqanchandioCommented:
have u wriiten the program ur self or gotten it from somewhere
0
 
furqanchandioCommented:
you are supposed to supply the infile.dat file ur self
0
 
cuong5985Author Commented:
I just want to give an example and get that example from a book.  THanks for your comment.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now