file.read() more then byte

Hi ,

I need to read BMP file.

I define structure for header. For example:

typedef struct { WORD bfType; DWORD bfSize; WORD bfReserved1; WORD bfReserved2; DWORD bfOffBits; } bmpHead;

How can I read by block from file, if file.read() is just read one byte?

master3d:
Hi ,

I need to read BMP file.

I define structure for header. For example:

typedef struct
{
WORD bfType;
DWORD bfSize;
WORD bfReserved1;
WORD bfReserved2;
DWORD bfOffBits;
} bmpHead;

How can I read by block from file, if file.read() is just read one byte?

The online reference is kinda limited, look at the SD.h. Mine (Window 7) is at
C:\Program Files\Arduino\libraries\SD\src\SD.h

#include <SPI.h>
#include <SD.h>

#define SDCARDPIN 10
#define offsetToHeader 15L

File f;
typedef uint16_t WORD;
typedef uint32_t DWORD;

typedef struct
{
   WORD    bfType;        
   DWORD   bfSize;        
   WORD    bfReserved1;   
   WORD    bfReserved2;  
   DWORD   bfOffBits;     
} bmpHead; 

bmpHead head;

void setup(){
SD.begin(SDCARDPIN);
f = SD.open("bmpfile.bmp",FILE_READ);
f.seek(offsetToHeader);
f.read((void*)&head,sizeof(head));
f.close();
}

void loop(){
}

Chuck.

Thanks!!! It works!