Functions > di_copy_header

Syntax 

The di_copy_header function is used to copy CODAS (WinDaq data format) header information into a BASIC structure.

Syntax 

unsigned FARC PASCAL di_copy_header(unsigned hdr_index, void FAR *dest, unsigned byte_count, unsigned clear_bits);

unsigned hdr_index

/* offset from beginning of header */

void FAR *dest

/* destination structure name */

unsigned byte_count

/* number of bytes from header copied to dest */

unsigned clear_bits

/* mask for clearing flag bits */

Parameters

The di_copy_header function is used to copy CODAS header information into a BASIC structure, as defined by dest. If an offset of zero is specified (by hdr_index), a number of bytes (specified by byte_count) are copied to a structure (specified by dest) starting with the very first byte in the header. Similarly, specifying an offset of 10 (by hdr_index) will start the copy process with the tenth byte from the beginning of the header.

Return Value

The di_copy_header function returns flags that indicate whether or not WinDaq software has updated the header. When the header is updated, all flag bits are set to one (returned value is FFFF).

Dependencies

A running WinDaq application.

Remarks

The structures returned by di_copy_header32 and di_info32 have padding to align 32-bit structure members declared in HDRDEF32.H on 32-bit boundaries. They should be used with 32-bit Visual Basic or any 32-bit compiler that does not support the recommended -Zp2 switch on the command line. Although logically equivalent to di_copy_header, di_copy_header32 returns its Waveform Channel Information at byte offsets two higher than with di_copy_header.

Sample Code

Declare Function di_copy_header Lib "200SDK.DLL" (ByVal dr_index%,dest%,ByVal byte_count%,ByVal clear_bits%)

Dim flags%

'flag bits

Dim hdr_index%

'offset in header

Dim CODAS_header as CODAS_header_struct

'structure to store header information

Dim byte_count%

'number of bytes to copy

Dim clear_bits%

'mask to indicate which flag bits to clear

Sub Timer ()

'This program checks if the header was updated and copies the first 10 bytes of the header to the structure CODAS_header if it was, starting with the first byte, then clears the lsb of the flag bits.

hdr_index = 0

byte_count = 10

clear_bits = 1

flags = di_copy_header (hdr_index,CODAS_header,0,clear_bits)

if (flags and clear_bits) <> 0 then

'using only the lsb of flag bits

flags = di_copy_header (hdr_index,CODAS_header,byte_count,clear_bits)

end if

End Sub

 

Copyright © DATAQ Instruments, Inc.