# How to Draw lines in C/C++?



## aditya.shevade (Jun 1, 2007)

Hi

I was wondering. There is not graphics header file that we have in Windows, under linux.

So What to do, if I want to draw some straight lines in C/C++ under linux or unix?

I want to draw kind of a table. So, what to do? ASCII characters donot work.

Aditya


----------



## kaustav_geek (Jun 1, 2007)

ASCII Chars don't work ? Really ? Well... In case what you're telling is true, then I don't think there's any way...


----------



## Zeeshan Quireshi (Jun 1, 2007)

could you post ur bit of code that u wrote for ASCII characters , may then i can help .

also if u could draw a rought sketch of what u wanna do , it would be better


----------



## aditya.shevade (Jun 1, 2007)

^^ It's for a game of Tic-Tac-Toe. I just want to draw a 3X3 block of squares.

The code I used in windows is as follows :


```
printf("\n\n\n");

          printf("\n\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c",218,196,196,196,194,196,196,196,194,196,196,196,191);

          printf("\n\t\t\t\t%c ",179);

          printf("%c",game[0][0]);

          printf(" %c ",179);

          printf("%c",game[0][1]);

          printf(" %c ",179);

          printf("%c",game[0][2]);

          printf(" %c ",179);

          printf("\n\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c",195,196,196,196,197,196,196,196,197,196,196,196,180);

          printf("\n\t\t\t\t%c ",179);

          printf("%c",game[1][0]);

          printf(" %c ",179);

          printf("%c",game[1][1]);

          printf(" %c ",179);

          printf("%c",game[1][2]);

          printf(" %c ",179);

          printf("\n\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c",195,196,196,196,197,196,196,196,197,196,196,196,180);

          printf("\n\t\t\t\t%c ",179);

          printf("%c",game[2][0]);

          printf(" %c ",179);

          printf("%c",game[2][1]);

          printf(" %c ",179);

          printf("%c",game[2][2]);

          printf(" %c ",179);

          printf("\n\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c",192,196,196,196,193,196,196,196,193,196,196,196,217);
```

and when I use the same in linux, all I get is a strange combination of question marks and blanks.

So I wrote a program to find the ASCII values of the respective numbers, I found that lines are not there. The character set ends at 120 or so, there is nothing after that number but question marks.

Aditya


----------



## Manshahia (Jun 1, 2007)

to draw line u can use different algorithms like DDA, MID-Point etc etc...
very complicated though...


----------



## Zeeshan Quireshi (Jun 1, 2007)

try rewriting ther Code in C++ n compiling with latest version of GCC , 

coz what i think that the libraries with which you're linking ur application are old n thus don't support extended characters .


----------



## aditya.shevade (Jun 1, 2007)

I am using anjuta that came with OpenSuSE 10.2. Version 1.2.4a.
gcc is 4.0.3

Can you please tell me what else might I do? Or provide sample code?

Aditya


----------

