I was trying to run the sample application available in the
..epoc32ex\system\resourcefiles\readdata.
I used the same code, except that the STRUCT definitions and respective
RESOURCE allocation for the same, were made in the .RSS file itself. When
run, the application returns BAFL ERROR 4. The Resourcefile is opened using
the Resourcefile. OpenL() and the resource is read into a buffer using the
TResourceReader.SetBuffer().
Where am I wrong? Why is this sample not running, has anyone encounted such
error.
Structure of the Resource Data FIRST :
STRUCT DATA
{
WORD wrd=16;
WORD flags=0;
LONG lng;
BYTE byt;
DOUBLE dbl=0.0;
LTEXT ltxt; // variable length
}
void CResData::ConstructL(TResourceReader& aReader)
{
TInt var1=0;
// Interpret next bytes as a TInt16
iWrd = aReader.ReadInt16();
// Interpret next bytes as a TInt16
iFlags = aReader.ReadInt16();
// Interpret next bytes as a TInt32
iLng = aReader.ReadInt32();
// Interpret the next byte as a TInt8
iByt = aReader.ReadInt8();
// Interpret next bytes as a TReal
iDbl = aReader.ReadReal64();
// Interpret the next byte as the length of text. The text itself
follows this byte.
iLtxt = aReader.ReadHBufC16L();
}
Can someone please help me on this.
Thanks and regards.
Uva.
BAFL 4 error means that the position you are trying to read from lies beyond the end of the resource buffer. Check that the data in your resource file matches with your ReadXXX function calls.
Hi,
I am having a very similar problem, except I am performing 4x ReadInt32(). From the sdk documentation I understand that after each call to read, the current position within the resource buffer is updated and if the resulting position is beyond the end of the resource buffer, then the function raises a BAFL 4 panic.
If my resource only has 4x TInt32 members will the resulting position after the last read always be beyond the end of the resource buffer?
I am sorry if this sounds like a stupid question but the above panic is really doing my head in and I was wondering if you had any joy in solving your problem.