From: kagel AT quasar DOT bloomberg DOT com Date: Fri, 30 Aug 1996 07:20:30 -0400 Message-Id: <9608301120.AA05499@quasar.bloomberg.com > To: gilles_bouthenot AT mail DOT dotcom DOT fr Cc: djgpp AT delorie DOT com In-Reply-To: <01bb95f3$71842da0$529033c2@megar.fc-net.fr> (gilles_bouthenot@mail.dotcom.fr) Subject: Re: struct ffblk bug in C++ ? Reply-To: kagel AT dg1 DOT bloomberg DOT com Errors-To: postmaster AT ns1 Xref: news2.mv.net comp.os.msdos.djgpp:8045 From: "Gilles Bouthenot" Newsgroups: comp.os.msdos.djgpp Date: 29 Aug 1996 22:38:23 GMT Organization: C.I.A. Lines: 21 Nntp-Posting-Host: ppp82.fc-net.fr X-Newsreader: Microsoft Internet News 4.70.1155 Dj-Gateway: from newsgroup comp.os.msdos.djgpp Content-Type: text Content-Length: 490 I wrote the next program: #include #include main() { int s; struct ffblk dta; s=findfirst("*.*",&dta,0x10); while(s!=0) { printf("%s\n",dta.ff_name); s=findnext(&dta); } } It works perfectly when compiled in C (TEST.C) But when I rename it to TEST.CPP, the program doesn't work: the first two letters of ALL entries are missing !! I think that it is a bug in the declaration of the ffblk struct. Did you ever found this problem ? Thanks. DJGPP is simply great ! Check the faq. This is a known bug in GCC, actually I think it is in cc1plus, which we have to wait for FSF to repair. It will probably be fixed in the next release of DJGPP. The problem is that the C++ compiler does not perform structure packing properly. You can modify the ffblk structure declaration in dir.h as a workaround, just pack each element separately, or compile the function calling findfirst/findnext in "C" and call it from C++. -- Art S. Kagel, kagel AT quasar DOT bloomberg DOT com A proverb is no proverb to you 'till life has illustrated it. -- John Keats