Sponsored Content
Full Discussion: [ C++ ] Drawing Program.
Top Forums Programming [ C++ ] Drawing Program. Post 302152850 by porter on Friday 21st of December 2007 02:24:33 PM
Old 12-21-2007
Your page, as far as I can see only has a width and a height.

No storage for the representation of the page itself.

Code:
class Page
{
.....
char *pagedata;

       Page(....)
       {
            pagedata=new char[width*height];
       }

       ~Page()
       {
            delete pagedata;
       }

       plot_character(int x,int y,char c)
       {
            pagedata[(y*width)+x]=c;
       }

       void print_page()
       {
             int y=0;
             char *p=pagedata;
             while (y < height)
             {
                   fwrite(p,width,1,stdout);
                   fprintf(fp,"\n");
                   y++;
                   p+=x;
             }
       }
};

 

5 More Discussions You Might Find Interesting

1. Programming

Line-drawing character!

Hi guys, I'm trying to make my program to print out tables usings line-drawing character (alternate char. set) with Curses Library. However, it always prints out control characters (^@) instead of the correct ones. code example: mvwaddch(my_window, 23, 12, ACS_RTEE); appreciate your help,... (5 Replies)
Discussion started by: zecoj
5 Replies

2. Shell Programming and Scripting

Drawing

Hi, Is it possible to draw circle, box and other basic shapes using shell scripts ? If so can anyone please tell as how to do it. Thanks in advance. (3 Replies)
Discussion started by: abrd600
3 Replies

3. Programming

problems with drawing in x using xlib

Hi all, I'm currently learning xlib and I've encountered a bizarre mistake: function calls such as XDrawPoint, XDrawLine, etc., don't seem to work; a blank window with nothing in is appears. I believe this has something to do with the window manager I use, fluxbox. After checking the code and... (0 Replies)
Discussion started by: hydronium
0 Replies

4. Post Here to Contact Site Administrators and Moderators

Question Regarding Megabits Drawing

Dear Admins / Mods, I have been trying my luck with Megabits Drawing few times ;) but I am not sure how it works! :confused: http://i49.tinypic.com/2ake15f.jpg I have few questions:- Why this page for me is still showing 3 Lotto & 4 SuperForumLotto purchased even after the drawing... (22 Replies)
Discussion started by: Yoda
22 Replies

5. UNIX for Advanced & Expert Users

Server room drawing software

Hello All, I want to get ride of Excel/word and want some software to draw my server room racks/server and overall topology. Please share you opinion/experience. thanks inadvance (1 Reply)
Discussion started by: Vit0_Corleone
1 Replies
All times are GMT -4. The time now is 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy