![]() |
|
#1
|
|||
|
|||
Reading a file C++ hElp!!:(Hi guys,
I'm trying to read in a file, it's contents are in the form: 17.00 Mount:Teressa Adventure 18.00 Discover ... Now I need to store 17.00,18.00 etc in a 2d array(upper row), and MMount:Teressa Adventure(the whole string) in the same 2d array, so as to display it in a tabular form later on. I'm close to tearing my hair apart on this |
|||
|
#2
|
||||
|
||||
|
Quote:
Unfortunately, we can't help you yet because we have no idea what you know nor what you've tried. You need to help us by explaining everything you can about the problem, and post the section of the code you're having trouble with so we know what to tell you. Be sure to read the sticky at the top of the forum. Rule of thumb: 1) post some code 2) explain what it's supposed to do 3) explain what it actually does 4) tell us where and what you think the problem is 5) if compiler errors paste the errors here (do NOT paraphrase them) 6) Make sure we can find the lines by placing comments in the code -- many of us won't count to line 130 when a comment could show us where 130 is immediately Try to keep code segments short, under 20 lines if possible. __________________
The 3 Laws of the Procrastination Society: 1) Never do today that which can be put off until tomorrow 2) Tomorrow never comes |
|
#3
|
|||
|
|||
|
Quote:
Sorry I should have been more clearer/read the stickies before posting out The text file is in this format: 8 =ABC 18.00 Dr Who: Underworld 18.30 Collectors 19.00 News 19.30 The 7.30 Report 20.00 Catalyst =Seven 18.00 Seven News 18.30 Today Tonight 19.00 Home and Away 19.30 My Restaurant Rules 20.30 **END .... And the problem asks to print this out in a tabular format/ as a tv guide, with the timings at the top, and channels on the left. This is the partial code I wrote: CPP / C++ / C Code:
Cheers guys, |
|
#4
|
||||
|
||||
|
Well, Here's what I see right up front:
CPP / C++ / C Code:
CPP / C++ / C Code:
CPP / C++ / C Code:
Since ch is a char, simply used CPP / C++ / C Code:
strcmp compares strings and the string "=" is never equal to "=ABC" The rest of the posted code only executes as long as you read in a line starting with "=". Consider changing the second while to an if: CPP / C++ / C Code:
This is processing the time/show line... CPP / C++ / C Code:
You take it from there. __________________
The 3 Laws of the Procrastination Society: 1) Never do today that which can be put off until tomorrow 2) Tomorrow never comes |
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Airport Log program using 3D linked List : problem reading from file | batrsau | C Programming Language | 11 | 29-Feb-2008 07:44 |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 10:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 11:28 |
| Re: Programming Techniques | WaltP | C Programming Language | 0 | 09-Mar-2004 23:56 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The