Functions > di_buffer_free

Syntax 

The di_buffer_free function de-allocates the memory block set by di_buffer_alloc.

Syntax 

int di_buffer_free(chn);

unsigned chn;

/* specifies whether to de-allocate the input buffer (0) or output buffer (1)*/

Parameters

chn 

0 = input

1 = output

Note: Output functions are not available on all instruments. Check your hardware manual for output specifications.

The least significant bit of chn is the only bit checked to determine input or output. No bit is checked where output functions are not available.

Return Value

DI_NO_ERR No error

Dependencies

di_open

di_inlist or di_outlist

di_buffer_alloc

di_start_scan

di_buffer_status

di_stop_scan

Remarks

none

Sample Code

#include "200sdk.h"

int *input_buffer;

int *output_buffer;

main()

{

di_open ();

if((input_buffer = di_buffer_alloc(0,4096)) == NULL)

/* allocate input buffer */

printf("Insufficient memory or input buffer already allocated...\n");

if((output_buffer = di_buffer_alloc(1,4096)) == NULL)

/* allocate input buffer */

printf("Insufficient memory or output buffer already allocated...\n");

di_buffer_free(0);

/* free input buffer */

di_buffer_free(1);

/* free output buffer */

di_close ();

}

 

Copyright © DATAQ Instruments, Inc.