Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 02-10-2003, 11:35 PM   #1
Member (10 bit)
 
Join Date: May 2001
Location: Harvard University
Posts: 935
Send a message via ICQ to KronoLeginaire Send a message via AIM to KronoLeginaire
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.
Attached Files
File Type: zip text-emulator.zip (932 Bytes, 34 views)
KronoLeginaire is offline   Reply With Quote
Old 02-11-2003, 01:34 PM   #2
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
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.
doctorgonzo is offline   Reply With Quote
Old 02-11-2003, 02:08 PM   #3
Member (10 bit)
 
Join Date: May 2001
Location: Harvard University
Posts: 935
Send a message via ICQ to KronoLeginaire Send a message via AIM to KronoLeginaire
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.
KronoLeginaire is offline   Reply With Quote
Old 02-11-2003, 02:35 PM   #4
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
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.
doctorgonzo is offline   Reply With Quote
Old 02-13-2003, 10:15 AM   #5
Member (10 bit)
 
Join Date: May 2001
Location: Harvard University
Posts: 935
Send a message via ICQ to KronoLeginaire Send a message via AIM to KronoLeginaire
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.
KronoLeginaire is offline   Reply With Quote
Old 02-13-2003, 10:19 AM   #6
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
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.
doctorgonzo is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:30 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2