•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 426,441 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 2,257 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: 1222 | Replies: 1
![]() |
•
•
Join Date: May 2005
Posts: 42
Reputation:
Rep Power: 4
Solved Threads: 0
Winbatch, I have another Q for you. I have the whole project compiling but I am stuck with displaying all the Customer details from the Q. I can pass the Class Object "Tim" to the Queue with various details but I need to write these to a file when I quit the program.
I can read in from a file and insert into the Queue but I am having difficulty printing out all the details of the Queue. As you can see I have tryed to use a method call ShowAll in the Qclass but I am unfortunately getting nowhere.
Also and this is no doubt probably the easiest Q you will ever get. When I run the prog it will work perfectly so long as I do not leave spaces between my name. e.g. Enter name: TimMurphy but if I leave a space
eg Enter name: Tim Murphy then I encounter problems. I know the solution to this is "getline" but that has not worked either.
Any help would be greatly appreciated.
Regards
Tim
I can read in from a file and insert into the Queue but I am having difficulty printing out all the details of the Queue. As you can see I have tryed to use a method call ShowAll in the Qclass but I am unfortunately getting nowhere.
Also and this is no doubt probably the easiest Q you will ever get. When I run the prog it will work perfectly so long as I do not leave spaces between my name. e.g. Enter name: TimMurphy but if I leave a space
eg Enter name: Tim Murphy then I encounter problems. I know the solution to this is "getline" but that has not worked either.
Any help would be greatly appreciated.
Regards
Tim
Tim,
This shouldn't compile - look at this line in main.cpp
while((!in_file.eof())and (name != "")){
Even if it didn't compile, you try and read from the file if it it couldn't be opened... (Your cout says that a new file is created, I don't think that's true of an ifstream..) and even if it were, what would be the point of reading from an empty file?
This shouldn't compile - look at this line in main.cpp
while((!in_file.eof())and (name != "")){
Even if it didn't compile, you try and read from the file if it it couldn't be opened... (Your cout says that a new file is created, I don't think that's true of an ifstream..) and even if it were, what would be the point of reading from an empty file?
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- How to print to file (Perl)
- Printing HTML file (HTML and CSS)
- Reading in from file (C++)
- External queue struct using queue.c (C++)
- Shared Printer Problem.... (Windows NT / 2000 / XP / 2003)
- printing a .txt file (C)
- my 8-queen program does nothing-but I have no sintax errors (C)
Other Threads in the C++ Forum
- Previous Thread: Help : Pointers to array of class objects .
- Next Thread: C++ help


Linear Mode