![]() |
|
#1
|
|||
|
|||
opening files and displaying textCould someone help me with some C++ code. I need to open a file, display the contents and do some calculations. We need to use functions. i am a little confused on the opening of files. Many thanks
|
|
#2
|
||||
|
||||
|
Hi pin. I was hoping that someone else might answer because my familiarity with C++ is pretty slim. You should look through this forum though, because there are some good C++ code snippets here as well as some good tutorial locations.
For instance, this thread links to a particularly good page for file handling under c++. Here is some sample code of C++ for reading & writing files: CPP / C++ / C Code:
Listed below are several points about this code. I am unsure of what level of coding experience you have, so this may seem pretty basic.
Anyway, if you get some of your program done, you can post it here and let the really good C++ guys critique it. Good luck... Last edited by dsmith : 20-Feb-2004 at 09:56.
|
|
#3
|
|||
|
|||
many thanksI will post the part of the program soon. Many thanks for the start. I thought that I was a little vague. Talk to you soon.
|
|
#4
|
||||
|
||||
|
You actually can use void main() instead of int main(). Some compilers may not like it, though.
|
|
#5
|
||||
|
||||
|
Quote:
And since some compilers may not like it, why should you use something that doesn't work sometime. Use what works all the time. |
|
#6
|
||||
|
||||
|
Well, I've been using it with every console app I've ever done. It's never caused me any problems, and the only reason I knew it wasn't standard in the first place was because someone told me so. I've never heard of anyone actually having problems with it.
|
|
#7
|
||||
|
||||
|
I have. So go ahead and use it if you want, but do NOT recommend it to others. We want to teach good practices here.
|
|
#8
|
||||
|
||||
|
It has come to my attention that my previous post can be interpreted as harsh. I apologize for that, I did not mean it as a rebuke nor with malice. All I meant was the point under discussion in rare cases does cause problems. In most cases and on most compilers it seems fine, so use it if you want to, but just know it's not standard.
Again, please accept my apology. I'll watch it... |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Displaying Code Using Notepad | BobbyDouglas | Web Design Forum | 1 | 16-Aug-2003 07:03 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The