From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: Printing string in dos memory Date: 23 Sep 1996 21:13:14 GMT Organization: Cornell University Lines: 47 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <526uha$7gv@newsstand.cit.cornell.edu> References: <3246CBF0 DOT 58BA AT seitz DOT de> NNTP-Posting-Host: 128 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp I think the FAQ explains beautifully how to access DOS memory so, please, RTFM. sinan. Mirko Geffken wrote: >Hello, > >I need to print a string which was returned to me by vesa routine >00h. >What I did didn't work: > >----- BEGIN OF BUGGY PROGRAM ---------------- >typedef struct >{ > short offset, > segment; >} Toldptr; > >Toldptr return; > >string=(char *)return.segment*16+return.offset; >printf("%s\n",string); >----- END OF BUGGY PROGRAM ---------------- > >----- BEGIN OF WORKING, BUT BAD STYLE PROGRAM ------ >typedef struct >{ > short offset, > segment; >} Toldptr; > >char string[1000]; >Toldptr return; >dosmemcpy(return.segment*16+return.offset,1000,string); >prinf("%s\n",string); >----- END OF WORKING, BUT BAD STYLE PROGRAM ------ > >Maybe the upper one is stupid, but seems obvious for me. > >What did I do wrong? I would like to find out, because the string >is zero terminated and not necessarily up to 1000 chars long. > >Thanks for any help > >Mirko