I/O with puts/printf 
Author Message
 I/O with puts/printf

Hi there!

I have some problems/ questions concerning ansi i/o using printf
or puts.

1. I wanted to print out the character '%'. Not a problem at all when
using 'puts'. But 'puts' is sooo slow. So I tried printf:

2. When using 'printf' the '%'-character is evaluated. So I picked
up my big book on C and looked up: "Use '%%' to print a single '%'".
I did so and it worked... a little. Unfortunately I encountered a
very strange behaviour when trying to highlight the output:
'\033[1m%%\033[m'

Any following character is typed twice. What's going on here, and,
more interesting, how can I solve this problem?

3. Is there another solution which I have not found yet? It should
be fast, working on a PC and be able to admid all the funny things
ansi-codes can do.

4. How can I hide the cursor and show it again. The flickering while
printing a long string on the screen is really annoying.

Ciao
Dirk



Tue, 16 Nov 1999 03:00:00 GMT  
 I/O with puts/printf

Quote:
>>>>> On 30 May 1997 16:15:09 GMT


Dirk> 1. I wanted to print out the character '%'. Not a problem at all when
Dirk> using 'puts'. But 'puts' is sooo slow. So I tried printf:
That's interesting. I had expected puts being somewhat faster....
Dirk>
Dirk> 2. When using 'printf' the '%'-character is evaluated. So I picked
Dirk> up my big book on C and looked up: "Use '%%' to print a single '%'".
Dirk> I did so and it worked... a little. Unfortunately I encountered a
Dirk> very strange behaviour when trying to highlight the output:
Dirk> '\033[1m%%\033[m'
Dirk>
Dirk> Any following character is typed twice. What's going on here
Don't know. Probably, your escape sequence switches on some echo mode
on your display driver. I don't believe that this is related to C.
Dirk>
Dirk> 3. Is there another solution which I have not found yet? It should
Dirk> be fast, working on a PC and be able to admid all the funny things
Dirk> ansi-codes can do.
How about this:
    printf("%s\n","put here as many % as you want");
Dirk>
Dirk> 4. How can I hide the cursor and show it again. The flickering while
Dirk> printing a long string on the screen is really annoying.
This question is not related to C, and it depends on the platform you
are using (among others), so I suggest you post this on an appropriate
newsgroup.
--
Ronald Otto Valentin Fischer (PGP public key available on request)


http://ourworld.compuserve.com/homepages/ronald_fischer/


Mon, 22 Nov 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Diff between PPC OS / HPC OS/ eXP OS

2. printf() and puts()

3. printf, puts, gets etc don't work when stepping into

4. what is the difference between puts and printf ?

5. Why you should use puts(3) when you don't need printf(3)

6. printf() vs. puts()

7. why use puts instead of printf?

8. VC7: cstdio doesn't put printf in std

9. replacing printf with my printf, then calling C lib's printf

10. (void)printf() vs. printf()

11. Re(2): Re(2): (void)printf() vs. printf()

12. Re(2): (void)printf() vs. printf()

 

 
Powered by phpBB® Forum Software