473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

doubt in graphics

rampraveen
Expand|Select|Wrap|Line Numbers
  1. #include "stdio.h"
  2. #include "conio.h"
  3. #include "graphics.h"
  4. char far *vidmem=0xB8000000;
  5. main()
  6. {
  7.  
  8.     int gm,gd=DETECT;
  9.     int r,c,i;
  10.     char message[]="praveen";
  11.     initgraph(&gd,&gm,"");
  12.  
  13.     clrscr();
  14.     for(r=5;r<=20;r++)
  15.     {
  16.         for(c=5;c<=50;c++)
  17.             write2vdu('',64,r,c);
  18.     }
  19.     c=10;
  20.     for(i=0;i<=10;i++)
  21.     {
  22.         write2vdu(message[i],77,10,c);
  23.         c++;
  24.     }
  25.     getch();
  26. }
  27. write2vdu(char ch,char attr,int row,int col)
  28. {
  29. char far *v;
  30. v=vidmem+row*160+col*2;
  31. *v=ch;
  32. v++;
  33. *v=attr;
  34. }  
when i run this, it just show only white screen..but the author of this program says tat will show a box with some texts..any one help me to get correct output.thankyou....
Jul 14 '10 #1
9 2120
weaknessforcats
9,208 Expert Mod 8TB
I don't have a compiler old enough to compile thbs code.

I havent't seen far pointers in 20 years. Where did this code come from?
Jul 14 '10 #2
@weaknessforcats
from one c graphics book..
Jul 14 '10 #3
am using xp and intel motherboard..any problems wit tat..
Jul 14 '10 #4
weaknessforcats
9,208 Expert Mod 8TB
I am not able to compile this code so I can't analyse it for you. Sorry.
Jul 14 '10 #5
@weaknessforcats
it's k..i have one doubt in tat program..tat means in that top of the prgm we are using "char far *vidmem=0XB8000000;"
will u tell why we are using this..?,...thk u...
Jul 15 '10 #6
weaknessforcats
9,208 Expert Mod 8TB
vidmem is used in a calculation. The 0XB8000000 must have somethibng to do with the amount of video memory.

The fact that vidmen is a char far* means the pointer is located outside the current code segment. For this to work you need a compiler old enough to use segmented memory models which went out of existence about 1990.

Basically, I don't believe the code is going to work using any modern computer/compiler/video driver.
Jul 15 '10 #7
drhowarddrfine
7,435 Expert 4TB
@weaknessforcats
gcc will. I'm pretty sure that video address is still used though I don't know how Windows would react to it. I still see assembly code passed around using that on the assembly forums I visit. I haven't paid attention to this stuff in a few years though.
Jul 15 '10 #8
newb16
687 512MB
In real mode (including emulation of it in dos box in windows), 0xB800:0000 is the starting address of display buffer of cga (ega, vga) adapter in text mode. The problem is that write2vdu expects the text mode to be on, but initgraph puts the adapter into graphics mode.
Jul 15 '10 #9
thanks friends at last i got a correct output with windows xp also........thk you for all.......
Jul 16 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jean-Philippe Martin | last post by:
Hi all, It's my first post here, so you doubt I have a question :o) I want to develop a mini graphical editor. Imagine that I have 2 JFrame, I want to have one with a list of JToggleButton...
12
by: Sanjay | last post by:
hi, We are currently porting our project from VB6 to VB .NET. Earlier we used to make scale transformations on objects like pictureBox , forms etc.Now Such transformations are made on the...
1
by: Anand Ganesh | last post by:
Hi All, I have an image which is made to fit in a Window. The user can Zoom In or Zoom Out and Pan the image. These images are Engineering drawings which has been drawn to scale say 1 inch =...
10
by: Aykut | last post by:
Hi, we plan to develop an app. that will involve lots graphics operations like open, zoom rotate ect. and there will be a lot of math in it because of filters ,noise corrections ect. on image....
1
by: Danny van Kasteel | last post by:
Hi, I'm trying to make an ownerdrawn ListBox that can display a custom graphic and 2 lines of text per item. I have tried to set the following properties on a standard ListBox control: ...
6
by: SamSpade | last post by:
Public Function PicCreateGraphics() As Graphics 'Client should dispose this PicCreateGraphics = Graphics.FromImage(mDocumentImage) mPicCreateGraphicsSaved = PicCreateGraphics 'Saved so I can...
5
by: Charles A. Lackman | last post by:
Hello, I have created a complete PrintDocument and need to create an image from it. How is this done? e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality...
2
by: Hari Shankar | last post by:
Hello Guyz We are planning to simulate the front panel of a Car Radio in PC. We want to use it for demo purposes. Especially in situations where we don't have the actual hardware available, we...
12
by: Xah Lee | last post by:
Of Interest: Introduction to 3D Graphics Programing http://xahlee.org/3d/index.html Currently, this introduction introduces you to the graphics format of Mathematica, and two Java Applet...
5
by: =?Utf-8?B?TW9oYW1tYWQtUmV6YQ==?= | last post by:
Hi everyone. We're trying to diplay a message on the screen, and we want it to be always there, regardless of whether a new application is run, which may occupy that portion of the screen. Put...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.