there's a sumthing like a scandisk tool in linux that will run during
bootup when we have improper bootup. it looks sumthing like this:
[---------\ ] 46%
i find the spinning thingy in the progression bar very interesting.
they actually are animated charaters comprise of \ | / -
I would be grateful if u guys can tell me how to do that using C. Just
the spinning thingy...
thankyou 14 1536
BL wrote: i find the spinning thingy in the progression bar very interesting. they actually are animated charaters comprise of \ | / -
I would be grateful if u guys can tell me how to do that using C. Just the spinning thingy...
I'm not entirely sure, but my guess is that they use ncurses. curses are
just to make simple menus and such when you don't want all output to be
enforced at the current bottom of your terminal
BL wrote: there's a sumthing like a scandisk tool in linux that will run during bootup when we have improper bootup. it looks sumthing like this: [---------\ ] 46%
i find the spinning thingy in the progression bar very interesting. they actually are animated charaters comprise of \ | / -
I would be grateful if u guys can tell me how to do that using C. Just the spinning thingy...
thankyou
<ot>
#include <windows.h>
#include <stdio.h>
void print_spinney ();
void print_spinney ()
{
int i = 0;
char progress_chars[4] = "\\|/-";
for (i = 0; i < 4; ++i)
{
printf ("%c\r", progress_chars[i]);
Sleep(100);
}
}
int main (void)
{
int i = 0;
for (i = 0; i < 10; ++i)
{
print_spinney();
}
return 0;
}
Sleep() is not a standard function.
Neither is windows.h a standard header.
Use something specific for your operating system.
Additionally, this is group about the C language.
</ot>
Regards,
Jonathan.
--
C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
C Library: http://www.dinkumware.com/refxc.html
C99 Standard Draft: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/
Common C Programming Errors: http://www.drpaulcarter.com/cs/common-c-errors.php
"Women should come with documentation." - Dave
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
BL wrote: there's a sumthing like a scandisk tool in linux that will run during bootup when we have improper bootup. it looks sumthing like this: [---------\ ] 46%
i find the spinning thingy in the progression bar very interesting. they actually are animated charaters comprise of \ | / -
I would be grateful if u guys can tell me how to do that using C. Just the spinning thingy...
thankyou
I guess it would look something like...
void Spinner(void)
{
char spinner[4] = {'\\','|','/','-'};
static int state = 0;
printf("\b%c",spinner[state++]);
state %= 4;
}
and would be used like...
{
int work_not_completed(void);
void do_some_work(void);
while(work_not_completed())
{
Spinner();
do_some_work();
}
printf("\n");
}
- --
Lew Pitcher
IT Consultant, Enterprise Data Systems,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed are my own, not my employers')
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
iD8DBQFB+RDxagVFX4UWr64RAnipAJ9mtZYq/WNyOZV17jZzHZPvpG6tZQCgnYsx
7k5fdD1ei8ANgIH+tWgE3ck=
=OvJg
-----END PGP SIGNATURE-----
oh thanks man... the code works... erm a bit correction.. char
progress_chars[4] = "\\|/-"; it should be just char progress_chars[4] =
"\|/-";
it really works.... thank you!
Jonathan Burd wrote: BL wrote:
there's a sumthing like a scandisk tool in linux that will run during bootup when we have improper bootup. it looks sumthing like this: [---------\ ] 46%
i find the spinning thingy in the progression bar very interesting. they actually are animated charaters comprise of \ | / -
I would be grateful if u guys can tell me how to do that using C. Just the spinning thingy...
thankyou
<ot> #include <windows.h> #include <stdio.h>
void print_spinney ();
void print_spinney () { int i = 0; char progress_chars[4] = "\\|/-"; for (i = 0; i < 4; ++i) { printf ("%c\r", progress_chars[i]);
You want '\b' (backspace), not '\r' (carriage return).
Sleep(100); } }
int main (void) { int i = 0;
for (i = 0; i < 10; ++i) { print_spinney(); } return 0; }
Sleep() is not a standard function. Neither is windows.h a standard header. Use something specific for your operating system. Additionally, this is group about the C language. </ot>
Regards, Jonathan.
--
E-Mail: Mine is a gmx dot de address.
BL wrote: oh thanks man... the code works... erm a bit correction.. char progress_chars[4] = "\\|/-"; it should be just char progress_chars[4] = "\|/-";
it really works.... thank you!
This is wrong. In order to obtain a backslash character, it has to be
preceded by another backslash, as backslash is a special character in
strings/character constants. Thus, "\\|/-" will contain \, |, /, and -.
Please quote some context, so that people know which post you respond
too. If you are using google: Look for recent posts by "CBFalconer" in
comp.lang.c and read the signature.
-Michael
--
E-Mail: Mine is a gmx dot de address.
Lew Pitcher wrote: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
BL wrote:
there's a sumthing like a scandisk tool in linux that will run during bootup when we have improper bootup. it looks sumthing like this: [---------\ ] 46%
i find the spinning thingy in the progression bar very interesting. they actually are animated charaters comprise of \ | / -
I would be grateful if u guys can tell me how to do that using C. Just the spinning thingy...
thankyou
I guess it would look something like...
void Spinner(void) { char spinner[4] = {'\\','|','/','-'}; static int state = 0;
printf("\b%c",spinner[state++]);
As you usually want to mark some kind of progress, it
may be better the other way round: "%c\b" (otherwise,
you overwrite the last character which may be '*' or
something more useful).
In addition, I'd recommend a fflush(stdout) after
the printf() call (otherwise it very likely won't spin).
Cheers
Michael state %= 4; }
and would be used like...
{ int work_not_completed(void); void do_some_work(void);
while(work_not_completed()) { Spinner(); do_some_work(); } printf("\n"); }
- -- Lew Pitcher IT Consultant, Enterprise Data Systems, Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed are my own, not my employers') -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32)
iD8DBQFB+RDxagVFX4UWr64RAnipAJ9mtZYq/WNyOZV17jZzHZPvpG6tZQCgnYsx 7k5fdD1ei8ANgIH+tWgE3ck= =OvJg -----END PGP SIGNATURE-----
--
E-Mail: Mine is a gmx dot de address.
<quote>This is wrong. In order to obtain a backslash character, it has
to be
preceded by another backslash, as backslash is a special character in
strings/character constants. Thus, "\\|/-" will contain \, |, /, and -.
Please quote some context, so that people know which post you respond
too. If you are using google: Look for recent posts by "CBFalconer" in
comp.lang.c and read the signature.</quote>
yeah... but somehow my compiler refuse to work on that "\\|/-".....
BL <bo*******@yahoo.com> scribbled the following: <quote>This is wrong. In order to obtain a backslash character, it has to be preceded by another backslash, as backslash is a special character in strings/character constants. Thus, "\\|/-" will contain \, |, /, and -.
Please quote some context, so that people know which post you respond too. If you are using google: Look for recent posts by "CBFalconer" in comp.lang.c and read the signature.</quote> yeah... but somehow my compiler refuse to work on that "\\|/-".....
Please supply the exact source code you're using. Cut&paste, don't
retype. Also show how you are invoking the compiler and the exact error
messages it gives.
This will be of a lot more help than "somehow my compiler refuses to
work".
--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"I will never display my bum in public again."
- Homer Simpson
On 27 Jan 2005 08:22:07 -0800, BL
<bo*******@yahoo.com> wrote: oh thanks man... the code works... erm a bit correction.. char progress_chars[4] = "\\|/-"; it should be just char progress_chars[4] = "\|/-";
No, there is no such character as \|. That might possibly work on your
compiler, but it is undefined what \| does and on some compilers it will
result in just | (or even an error, since it's undefined behaviour
anything at all could happen). You have to escape the \ with another \
to prevent this.
On some systems you may also need fflush(stdout); after the printf(), \r
isn't guaranteed to flush the output.
Chris C
Michael Mair wrote: Jonathan Burd wrote: BL wrote:
there's a sumthing like a scandisk tool in linux that will run
during bootup when we have improper bootup. it looks sumthing like this: [---------\ ] 46%
i find the spinning thingy in the progression bar very
interesting. they actually are animated charaters comprise of \ | / -
I would be grateful if u guys can tell me how to do that using C.
Just the spinning thingy...
thankyou
<ot> #include <windows.h> #include <stdio.h>
void print_spinney ();
void print_spinney () { int i = 0; char progress_chars[4] = "\\|/-"; for (i = 0; i < 4; ++i) { printf ("%c\r", progress_chars[i]);
You want '\b' (backspace), not '\r' (carriage return).
Carriage return seemingly works just as well here.
--
aegis Sleep(100); } }
int main (void) { int i = 0;
for (i = 0; i < 10; ++i) { print_spinney(); } return 0; }
Sleep() is not a standard function. Neither is windows.h a standard header. Use something specific for your operating system. Additionally, this is group about the C language. </ot>
Regards, Jonathan.
-- E-Mail: Mine is a gmx dot de address.
aegis wrote: Michael Mair wrote:
Jonathan Burd wrote:
<snip> printf ("%c\r", progress_chars[i]);
You want '\b' (backspace), not '\r' (carriage return). Carriage return seemingly works just as well here.
I used the carriage return because he wanted
"just the thingy." However, I agree, that is not
the right way to do it even though it works
fine for this particular instance. '\b' is recommended.
Additionally, ``fflush(stdout);" should be added.
<snip>
Regards,
Jonathan.
--
"Women should come with documentation." - Dave
In article <11*********************@c13g2000cwb.googlegroups. com>, boo_lim86
@yahoo.com says... yeah... but somehow my compiler refuse to work on that "\\|/-".....
Then you have a typo that you are not seeing, or your compiler is broken.
--
Randy Howard (2reply remove FOOBAR)
In article <11**********************@f14g2000cwb.googlegroups .com>, ae***@mad.scientist.com says... You want '\b' (backspace), not '\r' (carriage return).
Carriage return seemingly works just as well here.
Who said the spinner would only be at the start of the line?
--
Randy Howard (2reply remove FOOBAR) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: PHPkemon |
last post by:
Hi there,
A few weeks ago I made a post and got an answer which seemed very logical.
Here's part of the post:
PHPkemon wrote:
> I think I've figured out how to do the main things like...
|
by: Martin MOKREJ© |
last post by:
Hi,
I'm looking for some easy way to do something like include in c or PHP.
Imagine I would like to have:
cat somefile.py
a = 222
b = 111
c = 9
|
by: TPJ |
last post by:
First I have to admit that my English isn't good enough. I'm still
studying and sometimes I just can't express what I want to express.
A few weeks ago I've written 'Python Builder' - a bash...
|
by: Az Tech |
last post by:
Hi people,
(Sorry for the somewhat long post).
I request some of the people on this group who have good experience
using object-orientation in the field, to please give some good ideas
for...
|
by: Michael B. |
last post by:
I was just thinking about this, specifically wondering if there's any
features that the C specification currently lacks, and which may be
included in some future standardization.
Of course, I...
|
by: srikanth |
last post by:
hi,
I have one file it filled with some values in rows/colums.
some times, some variables (in a particular row& column) may not be
filled. depending on the kind its filled i will go for...
|
by: yezi |
last post by:
Hi, all:
I want to record some memory pointer returned from malloc, is possible
the code like below?
int memo_index;
int i,j;
char *tmp;
for (i=0;i<10;i++){
|
by: Kevin |
last post by:
Hey guys. I'm looking to get together some VB programmers on Yahoo
messenger. I sit at a computer and program all day.
I have about 3 or 4 people already, but it would be really cool to
have a...
|
by: Jim |
last post by:
I am trying to write an HTTP/HTTPS proxy server in VB.Net 2005.
But, I don't really even know how the internal workings of a proxy should
act. Does anyone have anything on the protocols used in...
|
by: TPJ |
last post by:
Help me please, because I really don't get it. I think it's some stupid
mistake I make, but I just can't find it. I have been thinking about it
for three days so far and I still haven't found any...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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,...
| |