delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/09/08/06:46:07

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "philippe meynard" <philippe DOT meynard AT vendeeconcept DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pb with sprintf
Date: Thu, 8 Sep 2005 12:31:42 +0200
Organization: Guest of France Telecom's news reading service
Lines: 146
Message-ID: <dfp3ue$2tk$1@s1.news.oleane.net>
References: <dfmqgu$mfs$1 AT s1 DOT news DOT oleane DOT net> <gL-dnSZBgocSw4LeRVn-uQ AT comcast DOT com> <2497d9a2050907160124a508c7 AT mail DOT gmail DOT com>
NNTP-Posting-Host: 62.161.106.155
Mime-Version: 1.0
X-Trace: s1.news.oleane.net 1126175503 2996 62.161.106.155 (8 Sep 2005 10:31:43 GMT)
X-Complaints-To: abuse AT oleane DOT net
NNTP-Posting-Date: Thu, 8 Sep 2005 10:31:43 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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&nbsp;<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" &lt;<A=20
  href=3D"mailto:strstream AT gmail DOT com">strstream AT gmail DOT com</A>&gt; 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> &lt;<A =
href=3D"mailto:jwright AT comcast DOT net">jwright AT comcast DOT net=20
  </A>&gt; 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>&gt; Hi! All<BR>&gt;<BR>&gt; do you know if the =
function=20
    sprintf used dos call dpmi_int (0x21) or return <BR>&gt; the =
processor to=20
    the real mode or used malloc ?<BR>&gt; Because I use LWP =
(multitasking=20
    library) and I have a crash on this function<BR>&gt; sprintf =
!<BR>&gt; I=20
    used sprintf like this :<BR>&gt;<BR>&gt; char chaf[100]; <BR>&gt;=20
    sprintf(chaf,"%d\n",100);<BR>&gt;<BR>&gt;<BR>&gt;=20
    Thanks<BR>&gt;<BR>&gt;<BR>&gt;<BR>#include =
&lt;stdio.h&gt;<BR>#include=20
    &lt;string.h&gt;<BR><BR>int main(void) =
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;char=20
    chaf[100];<BR>&nbsp;&nbsp;&nbsp;&nbsp;sprintf(chaf, "%d", 100);=20
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;printf("chaf length is %d and looks like =

    %s\n",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strlen(chaf),=20
    chaf);<BR>&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    --- Albert Einstein =
---<BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0094_01C5B471.447687D0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019