Xref: news2.mv.net comp.os.msdos.djgpp:5723 From: Joern Sierwald Newsgroups: comp.os.msdos.djgpp Subject: Re: [_dos_]find{first|next} problem! Date: Mon, 08 Jul 1996 13:50:53 +0200 Organization: Technische Universitaet Hamburg-harburg Lines: 58 Message-ID: <31E0F61D.78D0@tu-harburg.d400.de> References: <836737189 DOT 11199 DOT 0 AT abwillms DOT demon DOT co DOT uk> NNTP-Posting-Host: hp25.rz.tu-harburg.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Alaric B. Williams wrote: > > Say, does anyone have any idea why: > > ffblk _ffblk; > int result = findfirst("*.PPM",&_ffblk,FA_ARCH | FA_RDONLY | > FA_HIDDEN | FA_SYSTEM); > while(!result) { > colours(_ffblk.ff_name); > result = findnext(&_ffblk); > ah.sprites++; > } > and > find_t _ffblk; > wh.length = 0; > int result = _dos_findfirst("*.RES",_A_ARCH | _A_RDONLY,&_ffblk); > while(!result) { > puts(_ffblk.name); > wh.length++; > result = _dos_findnext(&_ffblk); > } > /BOTH/ give filenames with the first two characters missing??? > The same code worked fine in DJGPP v1.x, but fails in the latest v2 > from SimTel... > > Thanx, > Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk > http://www.hardcafe.co.uk/Alaric/ This is a long known bug in gcc 2.7.2. The C++ part of the compiler doesn't pack the ffblk correctly. The C part works fine. Please edit the header file with the ffblk and insert a #pragma pack(1) struct... #pragma pack() pragma pack pair around the struct. Enjoy! Joern .. .. .. .. .. .. .. .. .. ..