Click here to Skip to main content
16,019,043 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CDBException while accessing slq server database using CDatabase class [modified] Pin
prasad_som22-Feb-07 17:54
prasad_som22-Feb-07 17:54 
GeneralRe: CDBException while accessing slq server database using CDatabase class Pin
Cyber Friend23-Feb-07 0:09
Cyber Friend23-Feb-07 0:09 
Questionwindows keyboard hook / postmessage / sendmessage Pin
viral_umang@hotmail.com22-Feb-07 3:25
viral_umang@hotmail.com22-Feb-07 3:25 
AnswerRe: windows keyboard hook / postmessage / sendmessage Pin
Cedric Moonen22-Feb-07 3:32
Cedric Moonen22-Feb-07 3:32 
GeneralRe: windows keyboard hook / postmessage / sendmessage Pin
viral_umang@hotmail.com22-Feb-07 4:07
viral_umang@hotmail.com22-Feb-07 4:07 
GeneralRe: windows keyboard hook / postmessage / sendmessage Pin
Cedric Moonen22-Feb-07 4:17
Cedric Moonen22-Feb-07 4:17 
AnswerRe: windows keyboard hook / postmessage / sendmessage Pin
AprNgp22-Feb-07 6:26
AprNgp22-Feb-07 6:26 
QuestionReading text file.. Code works but how to include with rest program ? Pin
Software_Specialist22-Feb-07 3:00
Software_Specialist22-Feb-07 3:00 
Hi all,
Its a simple console application to calculate quotation. Well its working fine but problem i am facing is i want to store the quotation to the file everytime when entered and also i want the text file to be displayed as output with all the entries made in past....

This structure should contain all the customer record details ..
struct Quotes
{
int QuoteNumber;
char Name[20];
int DeliveryCost;
int CarpetCost;
short Guarantee;
};
The below functtion displays final output(quotation) for the user who just entered his details...
void DisplayRecord(int QuoteNum, char Name[], float Cost, float DeliveryCharge, int GuaranteePeriod )
{
cout << setfill(' ')
<< setw(7) << QuoteNum << " | "
<< setw(NAME_COL_WIDTH) << Name << " | "
<< setw(1) << POUND_SIGN << setw(COST_COL_WIDTH-4) << Cost << " | "
<< setw(1) << POUND_SIGN << setw(DELIVERY_COL_WIDTH-4) << DeliveryCharge << " | "
<< setw(1) << POUND_SIGN << setw(TOTAL_COL_WIDTH-1) << Cost + DeliveryCharge << " | "
<< setw(7) << "Years: " << setw(GUARANTEE_COL_WIDTH) << GuaranteePeriod << " | "
<< endl;

}

Now there is a file containing quotation of previous customers, and i can access all the data through below mentioned coding...
But the problem is that i am unable to include this peace of code with rest of the program.
At present, user enter details and he recieves output of the total cost n all and nothing else happens...now i want the details to be stored to the text file and also it can be displayed frm the stored text file as output...

InFile.open("Quotes.txt", ios::in);

if(InFile.is_open())
{
while(!InFile.eof())
{
InFile.getline(Buffer, BUFF_LEN);
Customer[CustNum].QuoteNumber = atoi(Buffer);
InFile.getline(Buffer, BUFF_LEN);
strcpy(Customer[CustNum].Name, Buffer);
InFile.getline(Buffer, BUFF_LEN);
Customer[CustNum].DeliveryCost = atoi(Buffer);
InFile.getline(Buffer, BUFF_LEN);
Customer[CustNum].CarpetCost = atoi(Buffer);
InFile.getline(Buffer, BUFF_LEN);
Customer[CustNum].Guarantee = atoi(Buffer);
CustNum++;
}
}

Can any one help me out in this. I have not written code for storing data to text file yet but once ill get the above problem working i.e. to read the past entries frm text file as output, then i would continue further.

the text file format is exactly like structure created i.e.
QuoteNumber
Name
DeliveryCost
CarpetCost
Guarantee

Any or all help would be greatly appreciated...
Thanks a lot for giving your valuable time to this thread...
GeneralRe: Reading text file.. Code works but how to include with rest program ? Pin
Programm3r22-Feb-07 3:41
Programm3r22-Feb-07 3:41 
QuestionRe: Reading text file.. Code works but how to include with rest program ? Pin
David Crow22-Feb-07 5:56
David Crow22-Feb-07 5:56 
GeneralRe: Reading text file.. Code works but how to include with rest program ? Pin
Mark Salsbery22-Feb-07 7:09
Mark Salsbery22-Feb-07 7:09 
QuestionDetection of USB device Pin
Vjys22-Feb-07 2:18
Vjys22-Feb-07 2:18 
QuestionExact Difference between an Abstract Class and Interface in COM. Pin
uday kiran janaswamy22-Feb-07 1:11
uday kiran janaswamy22-Feb-07 1:11 
AnswerRe: Exact Difference between an Abstract Class and Interface in COM. Pin
Cedric Moonen22-Feb-07 1:21
Cedric Moonen22-Feb-07 1:21 
GeneralRe: Exact Difference between an Abstract Class and Interface in COM. Pin
uday kiran janaswamy22-Feb-07 1:34
uday kiran janaswamy22-Feb-07 1:34 
AnswerRe: Exact Difference between an Abstract Class and Interface in COM. Pin
prasad_som22-Feb-07 1:35
prasad_som22-Feb-07 1:35 
GeneralRe: Exact Difference between an Abstract Class and Interface in COM. Pin
Cedric Moonen22-Feb-07 1:49
Cedric Moonen22-Feb-07 1:49 
AnswerRe: Exact Difference between an Abstract Class and Interface in COM. Pin
prasad_som22-Feb-07 1:54
prasad_som22-Feb-07 1:54 
AnswerRe: Exact Difference between an Abstract Class and Interface in COM [modified]. Pin
CPallini22-Feb-07 1:59
mveCPallini22-Feb-07 1:59 
QuestionVc++ pore toolkit Pin
Satheeshkumar_Balakrishnan21-Feb-07 23:51
Satheeshkumar_Balakrishnan21-Feb-07 23:51 
AnswerRe: Vc++ pore toolkit Pin
Cedric Moonen21-Feb-07 23:55
Cedric Moonen21-Feb-07 23:55 
GeneralRe: Vc++ pore toolkit Pin
Reagan Conservative22-Feb-07 3:16
Reagan Conservative22-Feb-07 3:16 
GeneralRe: Vc++ pore toolkit Pin
Cedric Moonen22-Feb-07 3:30
Cedric Moonen22-Feb-07 3:30 
AnswerRe: Vc++ pore toolkit Pin
Hamid Taebi22-Feb-07 0:47
professionalHamid Taebi22-Feb-07 0:47 
QuestionDrag and Drop Pin
Try21-Feb-07 22:19
Try21-Feb-07 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.