|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (10 bit)
|
Writing to a text file in C++
Please look at the attched c++ source code and tell me how I can fix it to properly write the results to the text file. If you need more explanation let me know.
The program is a CPU loading utility, designed to put heavy mathmatical loads on CPUs to test their performance, not done yet, and will keep adding features but I compile the thing with no errors and it just dose not create/write to the test.txt file. I followed this tutorial here but then it did not work and I decided to try other approches I found around the internet. Please help. |
|
|
|
|
|
#2 |
|
Professional gadfly
|
Attached is the fix I made. I made the ofstream variable into a global one, and opened and closed it from within main. It still calls the write procedure to add to the file. I think the problem with your code is that every time you made a call to owriter, it tried to open the output file again, which of course it can't do.
The program seems to loop forever, though maybe I'm just not patient enough. |
|
|
|
|
|
#3 |
|
Member (10 bit)
|
oh, I got it. Thanks allot!
My problem now may be support, in my way of learning this language I'll need to ask allot of simple questions like 'is there a way to do this' or 'how would i go about doing this' I'm going to try dal-net irc programming channels, the ones on EFNet where no help. |
|
|
|
|
|
#4 |
|
Professional gadfly
|
Try the tutorials listed here or just Google things. That's how I have picked up my programming, along with going to Half Price Books and getting programming books.
|
|
|
|
|
|
#5 |
|
Member (10 bit)
|
I didn't think that starting a new thread would be wise so I ask you this. How can I start programming GUIs. I want to be able to make a GUI for this CPU brute application, which is being made specificly just to learn the language, so how would I get started making windows and such. From what i've been able to learn on the internet i need some kind of GUI IDE to do this so I have these resources: http://www.objectcentral.com/
V is freeware so I'm thinking its for me, I'm going to upgrade to the latest version of Dev C++ to work with, i was using Visual C++, it went down in flames do I'm going profile. I get the GUI libs now how can I learn to use them. in the meanwhile I'll be looking around on the site and here. |
|
|
|
|
|
#6 |
|
Professional gadfly
|
You don't need a GUI IDE to make Win32 apps. I used Dev-C++ and this tutorial to learn about GUI programming in Windows:
http://www.winprog.org/tutorial/ I am just starting out, but the stuff in that tutorial and some other stuff I researched online gave me the knowledge to make a simple text editor. Now that I have Visual Studio, I will learn more about MFC and so forth. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|