User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 423,506 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,637 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 2058 | Replies: 1
Reply
Join Date: Jul 2004
Posts: 2
Reputation: nita is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
nita nita is offline Offline
Newbie Poster

Help File processing problem

  #1  
Jul 23rd, 2004
hai I'm again
I already done my program below. the problem when i run no output appear.
basically I declare 2 file . 1 for input(InTransFile) another one for input and output(InMasterFile).Both in .dat.
I want to compare accno1(masterfile) and accno2(transfile). if they equal
have to overwrite balance1(masterfile) and next record from master will be read

below are the program

#include <iostream>
using std::cout;
using std::cin;
using std::ios;
using std::cerr;
using std::endl;
#include <fstream>
using std::ifstream;
using std::fstream;
#include<iomanip>
using std::setiosflags;
using std::resetiosflags;
using std::setw;
using std::setprecision;

#include <cstdlib>



main()
{
ifstream InTransFile("trans.dat",ios::in);
fstream InMasterFile("master.dat",ios::in|ios::out);


if (!InMasterFile)
{
cerr<<"file could not open\n" ;
exit(1);
}
if (!InTransFile)
{
cerr<<"file could not open\n";
exit(1);
}


int accno1;
int accno2;
double balance1;
double balance2;
int found = 0;

while (!InMasterFile.eof())
{
while (!InTransFile.eof())
{
if (found == 0)
if (accno1 == accno2)
found = 1;

}
cout<<found<<"found";
cout<<accno1<<"master";
cout<<accno2<<"tran";
cout<<accno1<<balance1;


}
return 0;
}
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2004
Posts: 250
Reputation: FireNet will become famous soon enough FireNet will become famous soon enough 
Rep Power: 6
Solved Threads: 6
FireNet's Avatar
FireNet FireNet is offline Offline
Posting Whiz in Training

Re: File processing problem

  #2  
Jul 23rd, 2004
One thing is that you are doing nothing much about the file i/o.Can you explain what you mean by no output.

Check the tutorial fourm for a fstream file i/o tutorial,might help .
See what you can, remember what you need

Fourzon | Earn via Coding
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 4:26 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC