Mail Archives: djgpp/1997/10/01/19:18:50
A user of pstoedit (ftp://sunsite.cnlab-switch.ch/mirror/X11/contrib/applications/pstoedit/pstoedit.html)
tried to make pstoedit under gjgpp. Unfortunately the program did not run as expected.
Together we found out that there might be a bug in the c-library function tempnam (not tmpnam !).
Under all other systems I known, tempnam returns a pointer to newly allocated memory if
the first parameter is 0. Under djgpp 2.01 it looks like that tempnam behaves the
same as tmpnam which returns a pointer to a static memory which is overwritten after
each call to tmpnam.
The following program illustrates the possible bug;
#include <iostream.h>
#include <stdio.h>
int main()
{
char * p1 = tempnam(0,"t1");
char * p2 = tempnam(0,"t2");
cout << p1 << " " << p2 << endl;
};
Normally one gets two different values whereas under
djgpp 2.01 p1 and p2 are the same.
Wolfgang
--
Wolfgang Glunz email: Wolfgang DOT Glunz AT mchp DOT siemens DOT de
- Raw text -