How to get data in file before the end of long execution time | Bytes (2024)

Home Posts Topics Members FAQ

patienceBG

How to get data in file before the end of long execution time | Bytes (1) 4 New Member

My C++ program made calculation several days and after electicity stop I lose all data. I try to print the data in intermediate files for every moment of interest and close these files with filename.close( ); but all data continue to appear in the text file (in the windows explorer) after the end of the program or after I stop the execution. Obviously the data stay in some buffer and I don’t know how to visualize them before the end.
Thanks!

May 6 '10 #1

Subscribe Reply

5 How to get data in file before the end of long execution time | Bytes (2) 1639 How to get data in file before the end of long execution time | Bytes (3)

jkmyoung

2,057 How to get data in file before the end of long execution time | Bytes (5) Recognized Expert Top Contributor

Please clarify:
"but all data continue to appear in the text file"

Did you want to edit the text file somehow?
How do you want to visualize the data?
How is the data written in the files?

May 7 '10 #2

reply

patienceBG

4 How to get data in file before the end of long execution time | Bytes (6) New Member

Hi, jkmyoung, thanks for the attention.
How is the data written in the files?
ofstream filename;
filename.open(" filename.txt", ios_base::out);
if (!filename) {cout<<" filename !open\n"; return 1;}
filename<< …<<"\n";
filename.close( );
How do you want to visualize the data? – Numbers in text file.
Did you want to edit the text file somehow? Yes, I copy the numbers from the text file and analyze them in Excel.
All works fine but I can access the data after the end of the program or after I stop the execution and this is to long and I already lose data from several days calculation.

I find some solution but is ridiculous. I make the program to print useless data parallel with the needed, this fill this stupid buffer, which I don’t know where is, and the data appear in the file in the windows expoler before the end of the execution. I sort them in Excel and discard the junk.
Thanks again!

May 7 '10 #3

reply

jkmyoung

2,057 How to get data in file before the end of long execution time | Bytes (8) Recognized Expert Top Contributor

Have you considered using different filenames? Eg
filename1.txt
filename2.txt
filename3.txt

I suggest having a timer somewhere in whatever loop you're using to output the data and switch files.
http://www.cplusplus.com/reference/clibrary/ctime/time/
so have something like:

Expand|Select|Wrap|Line Numbers

  1. time_ttimerStart=time();
  2. andintheoutputloop:
  3. if(time()-timerStart>3600){//abouteveryhour.
  4. flushoutputstream.
  5. closefile.
  6. renamefile.
  7. reopennewfileatoriginallocation.
  8. ...
  9. timerStart=time();//resetstarttime
  10. }

Just to clarify, you are doing the calculations manually, with human intervention? It's not fully automated, correct?

May 7 '10 #4

reply

patienceBG

4 How to get data in file before the end of long execution time | Bytes (9) New Member

Yes, I use timer and multiples files for some cycles and logic to protect them form reopening, but I never used “flush output stream” and I think, that this is what I need. I don’t know how exactly to use “flush”, but I shall read in internet. Thanks man.
Yes, the calculations are not fully automated, i shall need more than 100 years if they are. I look in the data, use my intuition, change some coefficients and start again, but even like this i need weeks for one analysis and they are hundreds. I work on new metod for automatic speech recognition and after 12 years dashing my head against the wall, finaly I have good results. The human speech is terrible thing.
Thanks again!

May 7 '10 #5

reply

patienceBG

4 How to get data in file before the end of long execution time | Bytes (10) New Member

It is simple “ filename<<flush ; “ and it works. Thanks, jkmyoung! God bless you!

May 8 '10 #6

reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 3662

Long execution time for a script: avoid error messages ?

by: Damien |last post by:

Hello to all, I've written a script that take quite a long time to execute (email sending). Last time I ran it, PHP gave me a "execution time limit exceeded" (or something like that), so I changed the value in php.ini. Now, the questions are : - How can I make sure I'm not going to have problems when execution time lengthens still ? I'm afraid to set too high a time limit in case other scripts run astray. - Can I "break" the job into...

PHP

10 5430

script execution time too long

by: Doug |last post by:

I have a script that does a huge database update, which takes a long time. However, the host I am running on (and I suspect most hosts) are running in "safe mode." This means I cannot change the maximum execution time of scripts. So, the script stops right in the middle of doing the update. On top of that, I am trying to make code that I can distribute to others. As of now, the only way that this script can be run is with sys admin...

PHP

7 2675

PHP Script - Efficient use of execution time

by: Adam |last post by:

Hi, I am working on a project that requires me to parse 52,005,167 rows in a MySQL table. I am using a series of PHP scripts for each test I would like to run on the data. For example I have one test that is to look for fields with consecutive values. If a row is found to have more than 4 fields containing consecutive values I would like to remove the row from the table. I understand that this will take a good deal of time to...

PHP

6 1707

Why am i getting same file pointers every time

by: Affan Syed |last post by:

Hi, I am getting this weird problem. I know what i am doing is strange.. i am using C++ vectors and fopen, but for some reason if i used ofstream in the similar scenario it would give me errors. So here is what i do. I create a new node and insert it in a vecotr as follows: nodeCreator = new cNode(location, skew, offset,Beaconify,nodeId,directory); gNodeVector.push_back(*nodeCreator); //now lets delete the memory we created for the node

C / C++

5 4156

Stored Procedure vs SQL huge difference in execution time

by: mas |last post by:

I have a Stored Procedure (SP) that creates the data required for a report that I show on a web page. The SP does all the work and just returns back a results set that I dump in an ASP.NET DataGrid. The SP takes a product area and a start and end date as parameters. Here are the basics of the SP. 1.Create temp table to store report results, all columns are created that will be needed at this point. 2.Select products and general...

Microsoft SQL Server

5 2437

Exorbitant execution time

by: Johannes Lebek |last post by:

Hi there, lately, I experienced a strange thing on my DB2 V8.1 on Windows: Some queries took a very long time. A snapshot discovered the following: Number of executions = 47 Number of compilations = 1 Worst preparation time (ms) = 2 Best preparation time (ms) = 2 Internal rows deleted = 0

DB2 Database

27 5933

to find execution time

by: vishnu mahendra |last post by:

cah you please tell me how to find the execution time of a program in c. thank you in advance, vishnu

C / C++

38 2561

execution time becomes unpredictable?!

by: vashwath |last post by:

Might be off topic but I don't know where to post this question.Hope some body clears my doubt. The coding standard of the project which I am working on say's not to use malloc.When I asked my lead(I have just started working) he said we should not use dynamic allocation in real time systems, the code will not run in predictable time period.Can anybody tell what does he mean?Why the execution time becomes unpredictable? Thanks

C / C++

9 5022

preg_match_all Maximum execution time of 60 seconds error

by: Shuan |last post by:

I am getting this error. Can it be fixed by setting more than 60 for the max_execution_time in php.in file? Fatal error: Maximum execution time of 60 seconds exceeded in categorycrawler.php on line 19 on this line i have regular expression preg_match_all(,,)

PHP

2 3042

Bad connection / maximum execution time exceeded PHP?

by: Richard |last post by:

Hello all, I am looking into issues with time-outs on a website. These appear to happen in a random way for some users. This is one example: Fatal error: Maximum execution time of 60 seconds exceeded in auth.php on line 5 auth.php contains:

PHP

9353

Changing the language in Windows 10

by: Hystou |last post by:

Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...

Windows Server

9975

Maximizing Business Potential: The Nexus of Website Design and Digital Marketing

by: jinu1996 |last post by:

In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...

Online Marketing

9788

Discussion: How does Zigbee compare with other wireless protocols in smart home applications?

by: tracyyun |last post by:

Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...

General

8794

AI Job Threat for Devs

by: agi2029 |last post by:

Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...

Career Advice

6623

Couldn’t get equations in html when convert word .docx file to html file in C#.

by: conductexam |last post by:

I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...

C# / C Sharp

5241

Trying to create a lan-to-lan vpn between two differents networks

by: TSSRALBI |last post by:

Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

Networking - Hardware / Configuration

5384

Windows Forms - .Net 8.0

by: adsilva |last post by:

A Windows Forms form does not have the event Unload, like VB6. What one acts like?

Visual Basic .NET

1 3889

transfer the data from one system to another through ip address

by: 6302768590 |last post by:

Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

C# / C Sharp

3 2765

Comprehensive Guide to Website Development in Toronto: Expert Insights from BSMN Consultancy

by: bsmnconsultancy |last post by:

In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

General

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisem*nts and analytics tracking please visit the page.

How to get data in file before the end of long execution time | Bytes (2024)

References

Top Articles
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated:

Views: 5855

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Rev. Porsche Oberbrunner

Birthday: 1994-06-25

Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838

Phone: +128413562823324

Job: IT Strategist

Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing

Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.