Date: Mon, 3 Jun 1996 14:08:19 +0200 (IST) From: Eli Zaretskii To: Jorrit Tyberghein Cc: DJGPP AT delorie DOT com Subject: Re: Bug in findfirst/findnext??? In-Reply-To: <31B2997B.4A7D@uz.kuleuven.ac.be> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Mon, 3 Jun 1996, Jorrit Tyberghein wrote: > But when I compile this program with 'gcc -x c++ -o test test.c' > (so I'm using the C++ compiler) it doesn't work correctly anymore. > In the output the two first characters are missing. I have to change > the printf line to 'printf ("%s\n", ff.fa_name-2);' to get the > correct output. This is a known bug in GCC 2.7.2: the C++ compiler doesn't pack structures correctly. A work-around is to surround the struct ff_blk declaration on with these: #ifdef __cplusplus #pragma pack(1) #endif . . . #ifdef __cplusplus #pragma pack() #endif