codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  need HELP importing a data file....  cbmplsu at 07:19 on Tuesday, March 03, 2009
 

Hello everybody, I'm trying to import a data file, "Junkyard.data", as a stream. It is saved in the same directory/folder as the program I'm writing, yet whenever I try to run my program, I get the error message that I'm supposed to when the opening of the file fails. Can anybody offer any help here?


#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;

void Header (ofstream& fout);
double Average (int numSalesmen, double cashSum);
void PrintSummary (ofstream& fout);
double Process (ifstream& fin, ofstream& fout);

int main()
{
ifstream fin;
ofstream fout;
double avgSales;
double audiSold;
double bmwSold;
double jagSold;
double lexSold;
double cashSum;
int numSalesmen;

fin.open("Junkyard.data");
if (fin.fail());
{
cout << "ERROR: input file\n";
exit(1);
}

fout.open("Report.out");
if (fout.fail());
{
cout << "ERROR: output file\n";
exit(1);
}

Header(fout);
Process(fin, fout);
Average(numSalesmen, cashSum);
PrintSummary(fout);

.
.
.
.
.










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Passing Password using $ssh->cmd
•  Re: sum of columns
•  pop up Click-able Calendar need to output to 3 text fields
•  need HELP importing a data file....
•  Read Huge File into Hash
•  Client Server Communication
•  Linking two separate iframes from two different wepages
•  Linking two separate iframes from two separate webpages
•  Re: number of regex match


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009