hi can anyone help me with this prog. cant find the prob why it cant display
i have created a file input but when i display it the output is not there what is the problem? when compiling it shows no error!!HELP!!
thanks in advance.
regrads
andrew
Code:
cout<<"This is the display of your transaction"<<endl; ifstream fobj; //declare input file stream fobj.open("trans.txt"); //open file if(!fobj) //File not opened { cout<<"File cant open "<<endl; return 1; } cout<<"<Date>"<<"\t\t<Name>"<<"\t<AccountNo>"<<"\t<AccountType>"<<"\t<TransType>"<<"\t<Amount>"<<endl; fobj>>timestamp>>name>>acc>>type>>trans>>amount; while(fobj) { cout<<timestamp<<"\t"<<name<<"\t"<<acc<<"\t"<<type<<"\t\t"<<trans<<"\t\t"<<amount<<endl; fobj>>timestamp>>name>>acc>>type>>trans>>amount;
Code:
ofstream fobj; //declare input file stream fobj.open("c:\\trans.txt",ios::app); //open file if(!fobj) //File not opened { cout<<"File cant open "<<endl; return 1; } else { fobj<<timestamp<<","<<name<<","<<acc<<","<<type<<","<<trans<<","<<amount<<endl; } fobj.close(); //close file
thanks in advance.
regrads
andrew
Comment