Mail Archives: djgpp/1996/09/24/17:06:44
I think the FAQ explains beautifully how to access DOS memory so, please, RTFM.
sinan.
Mirko Geffken <mirko AT seitz DOT de> 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
- Raw text -