LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-10-2002, 07:42 AM   #1
wwnn1
Member
 
Registered: Apr 2002
Location: PRC
Posts: 32

Rep: Reputation: 15
Unhappy 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!
 
Old 05-10-2002, 02:27 PM   #2
Hano
Member
 
Registered: Sep 2001
Location: Venezuela, Caracas
Distribution: RedHat 9.0
Posts: 196

Rep: Reputation: 30
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
 
Old 05-11-2002, 02:04 AM   #3
wwnn1
Member
 
Registered: Apr 2002
Location: PRC
Posts: 32

Original Poster
Rep: Reputation: 15
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!
 
Old 05-13-2002, 11:55 AM   #4
herambshembekar
Member
 
Registered: Feb 2002
Location: India
Distribution: redhat 7.1
Posts: 70

Rep: Reputation: 15
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).
 
Old 05-13-2002, 05:42 PM   #5
Winter
LQ Newbie
 
Registered: May 2002
Location: Washington State
Distribution: Red Hat 7.0
Posts: 22

Rep: Reputation: 15
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
 
Old 05-14-2002, 07:55 AM   #6
wwnn1
Member
 
Registered: Apr 2002
Location: PRC
Posts: 32

Original Poster
Rep: Reputation: 15
Thanks all.

I will try all of the ways that you offered!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to tell a C++ programme to quit ? yogeshm02 Programming 3 09-09-2005 05:59 AM
allow ssh then kill the programme master Linux - Security 4 02-06-2005 02:17 AM
How to modify the library path variable?modify the Electronkz Linux - Newbie 1 04-13-2004 06:18 AM
how to access ftp using c++ programme ? mphreddy Programming 1 10-28-2003 03:01 AM
modify file access & modify timestamps i2itstud Linux - General 1 05-20-2003 03:34 AM


All times are GMT -5. The time now is 01:38 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration