Mail Archives: djgpp/2005/09/08/06:46:07
This is a multi-part message in MIME format.
------=_NextPart_000_0094_01C5B471.447687D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Yes it's just a simplification.
The code work fine in a single task, but when there are 2 ou 3 tasks who =
used sprintf, this code crash.
My question=20
do you know if the function sprintf used dos call dpmi_int (0x21) or =
return=20
the processor to the real mode or used malloc ?
because malloc is not "reentrant" or multitask!
Sorry for my english.
Thanks
"Matthew Petricone" <strstream AT gmail DOT com> a =E9crit dans le message de =
news: 2497d9a2050907160124a508c7 AT mail DOT gmail DOT com...
Aye, is this the actuall code that's giving you the problem or just a =
simplification?
On 9/7/05, Joe Wright <jwright AT comcast DOT net > wrote:
philippe meynard wrote:
> Hi! All
>
> do you know if the function sprintf used dos call dpmi_int (0x21) =
or return=20
> the processor to the real mode or used malloc ?
> Because I use LWP (multitasking library) and I have a crash on =
this function
> sprintf !
> I used sprintf like this :
>
> char chaf[100];=20
> sprintf(chaf,"%d\n",100);
>
>
> Thanks
>
>
>
#include <stdio.h>
#include <string.h>
int main(void) {
char chaf[100];
sprintf(chaf, "%d", 100);=20
printf("chaf length is %d and looks like %s\n",
strlen(chaf), chaf);
return 0;
}
Can't guess your problem. The above code works fine here.
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."=20
--- Albert Einstein ---
------=_NextPart_000_0094_01C5B471.447687D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Yes it's just a =
simplification.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The code work fine in a single task, =
but when there=20
are 2 ou 3 tasks who used sprintf, this code crash.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>My question </FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>do you know if=20
the function sprintf used dos call dpmi_int (0x21) or return <BR> =
the=20
processor to the real mode or used malloc ?</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>because malloc=20
is not "reentrant" or multitask!</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>Sorry for my=20
english.</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman"=20
size=3D3>Thanks</FONT><BR></DIV></FONT>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Matthew Petricone" <<A=20
href=3D"mailto:strstream AT gmail DOT com">strstream AT gmail DOT com</A>> a =
=E9crit dans le=20
message de news: <A=20
=
href=3D"mailto:2497d9a2050907160124a508c7 AT mail DOT gmail DOT com">2497d9a20509071=
60124a508c7 AT mail DOT gmail DOT com</A>...</DIV>Aye,=20
is this the actuall code that's giving you the problem or just a=20
simplification?<BR><BR>
<DIV><SPAN class=3Dgmail_quote>On 9/7/05, <B =
class=3Dgmail_sendername>Joe=20
Wright</B> <<A =
href=3D"mailto:jwright AT comcast DOT net">jwright AT comcast DOT net=20
</A>> wrote:</SPAN>
<BLOCKQUOTE class=3Dgmail_quote=20
style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: =
rgb(204,204,204) 1px solid">philippe=20
meynard wrote:<BR>> Hi! All<BR>><BR>> do you know if the =
function=20
sprintf used dos call dpmi_int (0x21) or return <BR>> the =
processor to=20
the real mode or used malloc ?<BR>> Because I use LWP =
(multitasking=20
library) and I have a crash on this function<BR>> sprintf =
!<BR>> I=20
used sprintf like this :<BR>><BR>> char chaf[100]; <BR>>=20
sprintf(chaf,"%d\n",100);<BR>><BR>><BR>>=20
Thanks<BR>><BR>><BR>><BR>#include =
<stdio.h><BR>#include=20
<string.h><BR><BR>int main(void) =
{<BR> char=20
chaf[100];<BR> sprintf(chaf, "%d", 100);=20
<BR> printf("chaf length is %d and looks like =
%s\n",<BR> strlen(chaf),=20
chaf);<BR> return 0;<BR>}<BR><BR>Can't guess =
your=20
problem. The above code works fine here.<BR>--<BR>Joe =
Wright<BR>"Everything=20
should be made as simple as possible, but not simpler."=20
=
<BR> &nb=
sp; =20
--- Albert Einstein =
---<BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0094_01C5B471.447687D0--
- Raw text -