reading file header into a descriptor
| Fri, 2005-08-05 04:33 | |
|
Hi,
I am trying to read the header of a AMR (6 bytes total) or WAV (2 or 4 bytes at a time) file into a descriptor, but I can't seem to get it working. I have tried usinh a HBufC, but this only works (sort of) with the WAV file. Basically I need to extract the information contained in the file header, 2, 4 or 6 bytes at a time. Does anyone know how I could do this? Thanks, Miranda |
|






Forum posts: 142
yucca
Forum posts: 70
I have tried a number of different ways but they mainly look something liek this:
RFileReadStream fRead;
TInt err = fRead.Open(aFs, KFileName, EFileRead);
if(err == KErrNone) {
RDebug::Print(_L("!!! file open successful!"));
}
CleanupClosePushL(fRead);
HBufC* header = HBufC::NewL(fRead, 6);
if(header->Compare(KAMR) == 0) {
RDebug::Print(_L("AMR header"));
} else {
RDebug::Print(_L("not AMR header"));
}
I think the problem with this is the max length (6) in the NewL...
How would I do it using TBuf8<6>?
Thanks again,
Miranda
Forum posts: 70
TBuf8<4> header;
fRead.ReadL(header);
if(header.Compare(KRIFF) == 0) {
RDebug::Print(_L("RIFF header"));
} else {
RDebug::Print(_L("not RIFF header"));
}
and for an AMR file like this:
TBuf8<6> header;
fRead.ReadL(header);
if(header.Compare(KAMR) == 0) {
RDebug::Print(_L("AMR header"));
} else {
RDebug::Print(_L("not AMR header"));
}
Thanks for your help!