Thread: Address_problem

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    2

    Address_problem

    hello...
    i wrote this program to fill the screen with 2000 copies of single of character, by acces the address of memory on video memory
    but this program does not work well....help plz

    here is the code...

    #include<stdio.h>
    #include<conio.h>
    #define LENGTH 2000
    void main(void)
    {
    int far *farptr;
    int position;
    char ch;
    printf("\nType character to start, type again to change");
    farptr= (int far *) 0XB800000L;
    while((ch=getch()) != '\r')
    for(position=0; position<LENGTH; position++)
    *(farptr + position)= (int)ch | 0x0700;
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Please use [code][/code]Tags

    Unless your OS is really DOS (not some emulation in say XP), then it isn't going to work.

    It's been at least a decade since anyone did any serious work with such old compilers, perhaps it's time you upgraded.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed