Mail Archives: djgpp/1996/09/23/14:36:19
From: | Mirko Geffken <mirko AT seitz DOT de>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Printing string in dos memory
|
Date: | Mon, 23 Sep 1996 19:42:08 +0200
|
Organization: | SEITZ GmbH
|
Lines: | 40
|
Message-ID: | <3246CBF0.58BA@seitz.de>
|
Reply-To: | mirko AT seitz DOT de
|
NNTP-Posting-Host: | pcmge.seitz.de
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
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 -