next up previous contents index
Next: Quick Guide to HBOOK Up: Event I/O Library Previous: Description   Contents   Index

Example

The following C code fragment copies the first 1000 events from one file into a second file, and forces the new file to have a blocksize of 1024 longwords.
 int blocksize = 1024; 
 ... 
 if (evOpen("input","r",&handle)==S_SUCCESS) { 
   if (evOpen("output","w",&handle2)==S_SUCCESS) { 
     evIoctl(handle2,"b",&blocksize); 
     for (i=0;i<1000;i++) { 
       if(evRead(handle,buffer,buflen)!=S_SUCCESS) break; 
       if(evWrite(handle2,buffer)!=S_SUCCESS) break; 
     } 
     evClose(handle2); 
   } 
   evClose(handle); 
 }
Using variations on this code, simple utilities for extracting events of a particular type or matching particular criteria may be written.



Mohammad Ahmed 2003-07-23