![]() |
|
#1
|
|||
|
|||
A problem with file I/OHi,
What I actually want to do is really quite simple,that is, convert all the data(of short type)in a file to their abstract values respectively.But I did not accomplish it. Here my code is listed: CPP / C++ / C Code:
The program can be compiled without error but it seemed to be trapped in a dead loop(a time too long for me to be tolerant,exactly) and the output file turned out to be very large in stead of being the same size as input file when I terminated the program by force. Anybody can tell me where I made mistakes and give me some clue for a effctive solution?Thank u in advance.I use VS 2005 if that makes any difference. nanchuangyeyu |
|||
|
#2
|
|||
|
|||
Re: A problem with file I/OQuote:
After fiddling around, my guess is your 'predicted_file.pre' resides in the same folder with the executable and you're running your program from the VC++ debug menu or something. The thing seems to be, though, that it doesn't look for the files there. With my project name being 'absvalue', it looked for the files in the absvalue\absvalue directory. It also wrote the output file there. This wasn't any indication to you? Running the .exe manually works like you'd expect it to. If this wasn't the case, then I don't know. |
|
#3
|
||||
|
||||
Re: A problem with file I/OYou probably need to take a closer look at how you're going about debugging your code. Are you verifying that your input is what you expect? What output (if any) is being generated?
I didn't have your input file, so I created one: CPP / C++ / C Code:
Code:
Code:
...I know that it must be considerably laborious for you to use spaces between arguments, but a bit of whitespace does improve readability in code. You'll note also that I changed your "i" variable name to "value." Try to use 'i' 'j' 'k' etc, for loop control variables and name "real variables" something other than a single letter. MxB |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CD Burner Help - Power Calibration Error.... | JonBoy420 | Computer Hardware Forum | 111 | 19-Feb-2009 04:54 |
| bool problem in multi file format | pfanning | C++ Forum | 6 | 08-Mar-2008 18:45 |
| How to use the data obtain in one C file to another C file? | TommyC | C Programming Language | 12 | 15-Jan-2008 10:51 |
| Problem write to file | Peter_APIIT | C++ Forum | 6 | 11-May-2007 00:05 |
| File function | jamesbond000 | C Programming Language | 3 | 28-Mar-2007 23:32 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The