X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "philippe meynard" 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: References: <2497d9a2050907160124a508c7 AT mail DOT gmail DOT com> NNTP-Posting-Host: 62.161.106.155 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0094_01C5B471.447687D0" 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" 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 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 #include 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
Yes it's just a = simplification.
The code work fine in a single task, = but when there=20 are 2 ou 3 tasks who used sprintf, this code crash.
My question
do you know if=20 the function sprintf used dos call dpmi_int (0x21) or return 
= the=20 processor to the real mode or used malloc ?
because malloc=20 is not "reentrant" or multitask!
Sorry for my=20 english.
Thanks
"Matthew Petricone" <strstream AT gmail DOT com> a = =E9crit dans le=20 message de news: 2497d9a20509071= 60124a508c7 AT mail DOT gmail DOT com...
Aye,=20 is this the actuall code that's giving you the problem or just a=20 simplification?

On 9/7/05, Joe=20 Wright <jwright AT comcast DOT net=20 > wrote:
philippe=20 meynard wrote:
> Hi! All
>
> do you know if the = function=20 sprintf used dos call dpmi_int (0x21) or return
> the = processor to=20 the real mode or used malloc ?
> Because I use LWP = (multitasking=20 library) and I have a crash on this function
> sprintf = !
> I=20 used sprintf like this :
>
> char chaf[100];
>=20 sprintf(chaf,"%d\n",100);
>
>
>=20 Thanks
>
>
>
#include = <stdio.h>
#include=20 <string.h>

int main(void) = {
    char=20 chaf[100];
    sprintf(chaf, "%d", 100);=20
    printf("chaf length is %d and looks like = %s\n",
       strlen(chaf),=20 chaf);
    return 0;
}

Can't guess = your=20 problem. The above code works fine here.
--
Joe = Wright
"Everything=20 should be made as simple as possible, but not simpler."=20 =
           &nb= sp;        =20 --- Albert Einstein = ---

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