[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

draw line....

Posted on 2000-01-04
6
Medium Priority
?
243 Views
Last Modified: 2010-04-15
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.
0
Comment
Question by:aimui
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:dhymes
ID: 2325392
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.

Regards,
Dave
0
 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 2325543
How about this?


printf("__________________________________________________________\n");

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

Expert Comment

by:dhymes
ID: 2325641
jhance,

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.

Regards,
Dave
0
Live webcast with Pinal Dave

Pinal Dave will teach you tricks to help identify the real root cause of database problems rather than red herrings. Attendees will learn scripts that they can use in their environment to immediately figure out their performance Blame Shifters and fix them quickly.

 
LVL 32

Expert Comment

by:jhance
ID: 2325694
dhymes,

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.
0
 
LVL 2

Expert Comment

by:dhymes
ID: 2325736
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!
0
 
LVL 4

Expert Comment

by:nils pipenbrinck
ID: 2337119
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 --------

0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question