Mail Archives: djgpp/1996/08/30/07:38:52
Errors-To: postmaster AT ns1
Xref: news2.mv.net comp.os.msdos.djgpp:8045
From: "Gilles Bouthenot" <gilles_bouthenot AT mail DOT dotcom DOT fr>
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 <dir.h>
#include <stdio.h>
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
- Raw text -