How to print a line of fill character in C?
As you know, in C++ you can use setfill(char c); and setwidth( int length) to fill a line of a character.
It's line making a line of a character for output Code:
NAME DEPARTMENT LOCATION I'm wondering, how can I draw this line in C using printf() to format? ( no loop or repetiton ) |
You may need to write your own function, but I am not sure how to do it without leaking memory. It is not pretty but you can find an example on rosettacode.
http://rosettacode.org/wiki/Repeat_a_string#C |
Quote:
|
Would memset() work? You can use it to initialise a character array which can then be printed using printf().
|
Code:
#define repeat1max 1024 repeat1() fails. repeat2() leaks. |
Quote:
|
One would of course have to allocate the memory first if using memset. You would probably want to write your own function which would do it, print it to screen and then free up the memory.
|
why not print the details in you function and then free the memory in the function.
|
Quote:
Quote:
|
All times are GMT -5. The time now is 09:32 AM. |