Hello everyone,
I was wondering if (in pure command line, "non-visual" C++) there is a
simple way of regularly calling an output function in the background
while a process, e.g. loading of a huge file, is running. I am thinking
of displaying a classical
Loading.....
output where every second a new dot is displayed, for instance, maybe
starting anew after 10 dots or something.
I hope this is the appropriate group to post to...thanks for your help,
ambros 4 3190 am************* @googlemail.com wrote: I was wondering if (in pure command line, "non-visual" C++) there is a simple way of regularly calling an output function in the background while a process, e.g. loading of a huge file, is running. I am thinking of displaying a classical
Loading.....
output where every second a new dot is displayed, for instance, maybe starting anew after 10 dots or something.
I hope this is the appropriate group to post to...thanks for your help, ambros
int iteration = 0;
... // long process start
if (figure_out_tha t_another_secon d_passed)
{
int ndots = ++iteration % 10;
std::cout << "\rLoading" << std::string(ndo ts, '.');
std::cout.flush ();
}
There is no other way. If your OS supports threading, you could try
doing output in another thread and synchronize them somehow, but C++
language doesn't define any threading, you need to ask in another NG,
line one that's dedicated to your OS.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask am************* @googlemail.com wrote: Hello everyone,
I was wondering if (in pure command line, "non-visual" C++) there is a simple way of regularly calling an output function in the background while a process, e.g. loading of a huge file, is running. I am thinking of displaying a classical
Loading.....
output where every second a new dot is displayed, for instance, maybe starting anew after 10 dots or something.
I hope this is the appropriate group to post to...thanks for your help, ambros
The traditional way is to put a callback function in the lengthy
function that voluntarily calls the callback every so often. For
example you can print a spinning line / - \ | followed by backspace
each time. Otherwise you have to descend into threads, and lose the
useful property of knowing that the code has not crashed.
On Fri, 16 Jun 2006 08:05:34 -0700, ambros.gleixner wrote: I was wondering if (in pure command line, "non-visual" C++) there is a simple way of regularly calling an output function in the background while a process, e.g. loading of a huge file, is running. I am thinking of displaying a classical
Loading.....
output where every second a new dot is displayed, for instance, maybe starting anew after 10 dots or something.
I suggest instead of making it time-based, making it progress-based. For
example,
bool incremental_loa d()
{
// Load logical chunk of data from large file
// Return false if this is the last chunk, false if
// more data left.
}
void update_spinner( )
{
// Can be as fancy as you want. Here, just print dots.
std::cout << ".";
}
void main_loop()
{
while (incremental_lo ad())
update_spinner( );
}
Gregg
Thank you all for your quick comments! Sorry that I didn't repsond
immediately as I was held up the last days unexpectedly.
For what I'm trying to do it looks like I would have to start using
threads, and I am afraid that this wouldn't be worth the hassle for
just some fancy output. If I understood it correctly, it would also
make my programme platform dependent, which is a good thing to avoid. I
think I'll continue with constant dots. Thanks a lot for your advice,
ambrose This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Darren Dale |
last post by:
I am using Emacs Python mode, and my project involves reading large
datafiles and processing large arrays. I have some code that reports the
progress during these time consuming processes. It works fine from the
dos shell, but I would really like to work entirely within Emacs. I have
two questions:
1) Is it possible to have the *Python...
|
by: TJS |
last post by:
Can anyone see why the javascript below will not work in Firefox ?
=====================================================
<script runat = "server">
Private Sub Page_Load(sender As Object, e As System.EventArgs)
' This really doesn't serve any purpose, other than to help with the
sample code.
' After 10 seconds, the page will stop loading...
|
by: Kenneth Keeley |
last post by:
Hi,
I have a page that uploads files to my server and I wish to display a
"Please wait while uploading" page to the user while the file is uploading.
I have been able to redirect the user once the file is finished uploading
but am not sure how to do it while file is uploading.
Some sample code would be welcomed with open arms.
Thank You.
|
by: simon |
last post by:
when I execute aspx page, it works about 5 minutes - I calculate some
statistics.
Is there some way, that I can show user time bar or smething similar? That
he nows, that page is working.
Thank you,
Simon
|
by: sam |
last post by:
Hi - I have an ASP page - that will be making about 7 calls to a
database.
What I want is to show progress to the users so that they can tell each
database call is in progress.
The asp calling page works fine, but it only displays when the entire
process has been completed.
What I want is to be able to show dynimically - step 1 done;...
| |
by: balakrishnan.dinesh |
last post by:
hi frnds,
There is a problem in displaying the page itself, I have put
my html pages in server, the pages contains both html and javascript,
Some of the pages are displayed properly and some pages are displaying
as sourcecode itself, what we written for the page. this problem is
existing in my machine only,
My OS : 2003 professional...
|
by: Cogito |
last post by:
My program builds several tables using inner HTML. All the tables are
displayed only when the program terminates. How can I make it display
one table at a time and then wait for a click before displaying the
next table?
|
by: Nishanthmarathe |
last post by:
Hi There!!!
I am new to C# world.
I am getting huge chunk of data from a 3rd party applications thru SOAP request and updating to my SQL Server.
I cant implement Progress bar as there is no way to know how much data i will get back and its a complicated process.
So i decided to use a dummy progress bar, that is 5 moving dots, Which in turn...
|
by: kimiraikkonen |
last post by:
Hello,
I want to ask this: How can i equalise my progress bar with the
external process until it finishes?
For example i have external process and the processing time differs
computer by computer. What should be the code to equalise progress bar
movement with the process?
Thanks.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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...
| |
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |