• C

draw line....

How to draw a thicker line (bold the line) using C (UNIX) and output to a file.  I will use unix command "lp" to print to a laser printer.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I am not sure that I am allowed to answer this, are you a student that is working on a homework assignment? Don't get upset at my question, I just want to insure I am not breaking the rules.

How about this?


Beyond that, you'll have to be more specific about the printer itself as every type has it's own way drawing graphics.  

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

I am not sure this is the way the game is played after I posted my comment and was waiting for a reply.

As for your answer, first of all simply printing a sequence of underscores will certainly give you a straight line, but it will not increase the thickness of the line.

If you want to draw a line and have control of it's coordinates and thickness then you need to make use of the graphics library. A function like drawline() with the correct coordinats and fonts specified would be a more elaborite method.

The how of making use of the graphics library I will leave up to aimui so that he/she will get something out of the homework assignment.

The Lifecycle Approach to Managing Security Policy

Managing application connectivity and security policies can be achieved more effectively when following a framework that automates repeatable processes and ensures that the right activities are performed in the right order.


You didn't post an answer or a comment that addressed this question.  While there are rules about doing homework for other users, I would not classify this question as a homework problem.  

Sometimes it's obvious from the question that the user has just pasted the homework assignment into the question.  This question however, appears to be a small part of a larger problem and would be a fair question.
Mmmm, if you take a look at aimui's profile you will notice that he/she is a new user that just signed up. The answer is to simple for me to believe that this is not a programming 101 homework assignment.

It is your call, you have been out here longer than I. But i do think that you should insure that before submitting the answer you should fully understand the question, and from the information provided I don't see how you could have!
nils pipenbrinckCommented:
since you're using lp and unix you can do it with a little postscript code..

just write the following lines to a file with the extension .ps (for example line.ps) then use lp to print it. if you system is properly installed it will either be sent to a postscript printer or converted to a bitmap and printed afterwards..

if you want to draw more than one line just repeat the moveto lineto and stroke instructions.

all coordinates are in typographical points (1/72 inch I think).

--------- test.ps cut here --------
10 setlinewidth  % with of line
100 100 moveto   % startpoint
500 200 lineto   % endpoint
stroke           % draws the line
showpage         % prints the page
--------- test.ps cut here --------

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.