05.07.2013 Views

BSA Flow Software Installation and User's Guide - CSI

BSA Flow Software Installation and User's Guide - CSI

BSA Flow Software Installation and User's Guide - CSI

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

if (fh==-1) exit(1);<br />

// reading file header id<br />

_lseek(fh,0x000,SEEK_SET);<br />

_read(fh,id,sizeof(id));<br />

// reading file header version<br />

_lseek(fh,0x006,SEEK_SET);<br />

_read(fh,&version,sizeof(version));<br />

// reading file header size<br />

_lseek(fh,0x008,SEEK_SET);<br />

_read(fh,&size,sizeof(size));<br />

_close(fh);<br />

printf("id = %s, version %d, header size %d\n",id,version,size);<br />

return 0;<br />

//Ex2: Read first data array header<br />

int main(int argc, char* argv[])<br />

{<br />

long size = 0; // file header size<br />

char name[64] = {0};// data array name<br />

long datasize = 0; // data size = sizeof(double)<br />

long datacount = 0; // number of data samples<br />

}<br />

printf("Open <strong>and</strong> read first data header information\n");<br />

char filename[256] = {0};<br />

strcpy(filename,argv[1]);<br />

int fh = _open(filename,_O_RDONLY|_O_BINARY);<br />

if (fh==-1) exit(1);<br />

// reading file header size<br />

_lseek(fh,0x008,SEEK_SET);<br />

_read(fh,&size,sizeof(size));<br />

// reading data array name<br />

_lseek(fh,size + 0x006,SEEK_SET);<br />

_read(fh,name,sizeof(name));<br />

// reading data size<br />

_lseek(fh,size + 0x04E,SEEK_SET);<br />

_read(fh,&datasize,sizeof(datasize));<br />

// reading number of data samples<br />

_lseek(fh,size + 0x052,SEEK_SET);<br />

_read(fh,&datacount,sizeof(datacount));<br />

_close(fh);<br />

printf("%s data block size = %d\n",name,datasize*datacount);<br />

return 0;<br />

//Ex3: Read last data array block<br />

int main(int argc, char* argv[])<br />

{<br />

long fsize = 0; // file header size<br />

long dsize = 0; // file header size<br />

short arrays = 0; // number of data arrays<br />

char name[64] = {0};// data array name<br />

long datasize = 0; // data size = sizeof(double)<br />

long datacount = 0; // number of data samples<br />

long pos = 0; // pointer to last data header<br />

printf("Open <strong>and</strong> read last data array block\n");<br />

5-56 <strong>BSA</strong> <strong>Flow</strong> <strong>Software</strong>: Project explorer objects

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!