LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   how can I modify this programme? (http://www.linuxquestions.org/questions/programming-9/how-can-i-modify-this-programme-20639/)

wwnn1 05-10-2002 08:42 AM

how can I modify this programme?
 
The following programme runs succefully under ms-dos
but it can't run under linux(red hat 7.2)

is there some code that can perform the same function,and ,
of course,can run succeful under linux!



#include<stdio.h>

typedef struct texel_struct{
unsigned char ch;
unsigned char attr;
}texel;

typedef texel screen_array[25][80];
screen_array far * screen_ptr = (screen_array far *)0xb8000000L ;
#define screen (*screen_ptr)

main()
{
clrscr();
screen[0][0].ch = 'a';
screen[0][0].attr = 0x58;
getchar();
}


Thanks in advance!

Hano 05-10-2002 03:27 PM

I barely remember something about far keyword being no longer supported in new versions of gcc compilers (dont know which ones) maybe has something to do with that

Hano

wwnn1 05-11-2002 03:04 AM

Thanks!
 
Thank you Hano!

do you know
how can I assign memory address to pointer directly?

something like this:

char * ptr = 0x80000000;

Thanks in advance!

herambshembekar 05-13-2002 12:55 PM

fundamentals in linux says about user mode & kernel mode,
you are not previlaged to refer addresses other than address of that process in linux user mode.
You can try it inside kernel module ( just for test for which i am not too sure).(i think this as home work for me too).

Winter 05-13-2002 06:42 PM

if all you want to do is clear the screen..

create function

cls()
{
for(i=0; i<=25; ++i)
printf("\n");
}

thats how I do it in C

cls()
{
for(i=0; i<=25; ++i)
cout >> "newline"
}

I obviously dont know C++ syntax, but that is a shot at it..

then whenever you need to clear screen, call cls();

winter

wwnn1 05-14-2002 08:55 AM

Thanks all.

I will try all of the ways that you offered!


All times are GMT -5. The time now is 12:46 PM.