Click here to Skip to main content
15,903,033 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Handle Reuse Problems? Pin
Mark Salsbery26-Feb-07 10:16
Mark Salsbery26-Feb-07 10:16 
QuestionAccessing DLL Pin
vinith26-Feb-07 7:28
vinith26-Feb-07 7:28 
AnswerRe: Accessing DLL Pin
Mark Salsbery26-Feb-07 7:41
Mark Salsbery26-Feb-07 7:41 
GeneralRe: Accessing DLL Pin
vinith26-Feb-07 23:03
vinith26-Feb-07 23:03 
QuestionRe: Accessing DLL Pin
prasad_som26-Feb-07 19:48
prasad_som26-Feb-07 19:48 
QuestionMS Access Pin
shiraztk26-Feb-07 6:32
shiraztk26-Feb-07 6:32 
QuestionRe: MS Access Pin
David Crow26-Feb-07 9:04
David Crow26-Feb-07 9:04 
QuestionWhite space increased and one reference number jumped in simple console application Pin
Software_Specialist26-Feb-07 4:31
Software_Specialist26-Feb-07 4:31 
I have created a program for carpet factory which ask user all the detail and then stores the final quotation to the file, which can be displayed later.
The following function reads file and counts the number of entry and return the count to main to sort out reference number, reference number starts from 1000 and now every time user input data, next reference number should be provided.
int FillCustomersArray()
{
const int BUFF_LEN = 256;
char Buffer[BUFF_LEN];
fstream InFile;
CustNum = 0;

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

if(InFile.is_open())
{
while(!InFile.eof())
{
InFile >> ws;
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++;
}
}
InFile.close();

return CustNum;
}

Everything is working allright, except this small error...just have look to below stored file..

1005
Rotton J
3840.00
2536.00
5

1006
Brocket L
1100.00
0.00
11000

1007
gbush
1452
0
1


1009
gibson
2772
0
1


1010
BOB MARTIN
2772
1108.8
1


1011
JACOB
6006
1108.8
2

The first number is reference number, so till 1006 its all fine as these details were already existed in file and now 1007 is inputed correctly but after this the reference 1009 is taken and leaving 1 more line. So the gap between quotes is increased by 1 line and 1008 reference number is not used. And now all numbers would go in sequence but the space has increased to two white lines...
Daoes anybody know whats going on here.
I know its quite simple problem but i am not able to get hold of it...
Thanks a lot

QuestionRe: White space increased and one reference number jumped in simple console application Pin
Newbie0026-Feb-07 6:24
Newbie0026-Feb-07 6:24 
AnswerRe: White space increased and one reference number jumped in simple console application Pin
Software_Specialist27-Feb-07 9:38
Software_Specialist27-Feb-07 9:38 
GeneralRe: White space increased and one reference number jumped in simple console application Pin
Newbie0028-Feb-07 3:28
Newbie0028-Feb-07 3:28 
QuestionMS Access ActiveX VC++ Pin
shiraztk26-Feb-07 3:58
shiraztk26-Feb-07 3:58 
AnswerRe: MS Access ActiveX VC++ Pin
James R. Twine26-Feb-07 4:16
James R. Twine26-Feb-07 4:16 
GeneralRe: MS Access ActiveX VC++ Pin
shiraztk26-Feb-07 4:35
shiraztk26-Feb-07 4:35 
QuestionVisual Studio Just-In-Time Debugger Pin
Try26-Feb-07 3:12
Try26-Feb-07 3:12 
AnswerRe: Visual Studio Just-In-Time Debugger Pin
James R. Twine26-Feb-07 3:18
James R. Twine26-Feb-07 3:18 
AnswerRe: Visual Studio Just-In-Time Debugger Pin
Cedric Moonen26-Feb-07 3:19
Cedric Moonen26-Feb-07 3:19 
GeneralRe: Visual Studio Just-In-Time Debugger Pin
Try26-Feb-07 3:26
Try26-Feb-07 3:26 
GeneralRe: Visual Studio Just-In-Time Debugger Pin
James R. Twine26-Feb-07 4:14
James R. Twine26-Feb-07 4:14 
Questionobjective c Pin
deeps_cute26-Feb-07 2:46
deeps_cute26-Feb-07 2:46 
QuestionRe: objective c Pin
Maximilien26-Feb-07 3:37
Maximilien26-Feb-07 3:37 
Questionto display thumbnails on ListView Pin
vasu_sri26-Feb-07 1:22
vasu_sri26-Feb-07 1:22 
AnswerRe: to display thumbnails on ListView Pin
James R. Twine26-Feb-07 1:35
James R. Twine26-Feb-07 1:35 
AnswerRe: to display thumbnails on ListView Pin
Naveen26-Feb-07 2:13
Naveen26-Feb-07 2:13 
QuestionRe: to display thumbnails on ListView Pin
Hamid_RT26-Feb-07 7:26
Hamid_RT26-Feb-07 7:26 

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.