21char *USAGE =
"readexample <SDDSinput>\n\
22This program is a simple example that illustrates the use of\n\
23SDDS input routines.\n\
24Program by Michael Borland. ("__DATE__
26 ", SVN revision: " SVN_VERSION
")\n";
30main(
int argc,
char **argv) {
33 char *column_name[COLUMNS] = {
"f",
"FFT"};
34 char *column_units[COLUMNS] = {
"MHz",
""};
40 fprintf(stderr,
"error: no input file given\nusage: %s\n", USAGE);
51 for (i = 0; i < COLUMNS; i++) {
53 if ((code =
SDDS_CheckColumn(&SDDS_dataset, column_name[i], column_units[i], 0, NULL)) == SDDS_CHECK_NONEXISTENT) {
54 fprintf(stderr,
"column %s not in file\n", column_name[i]);
57 if (code == SDDS_CHECK_WRONGUNITS) {
58 fprintf(stderr,
"column %s doesn't have expected units (%s)\n", column_name[i], column_units[i]);
64 fprintf(stderr,
"first page of data set is unreadable or empty\n");
70 fprintf(stderr,
"unable to read column %s\n", column_name[0]);
76 fprintf(stderr,
"unable to read column %s\n", column_name[0]);
82 fprintf(stderr,
"unable to read column %s\n", column_name[1]);
87 for (i = 0; i < rows; i++)
88 fprintf(stderr,
"row %ld: %ld, %e, %e\n", i, fl[i], f[i], FFT[i]);
SDDS (Self Describing Data Set) Data Types Definitions and Function Prototypes.
int32_t SDDS_CheckColumn(SDDS_DATASET *SDDS_dataset, char *name, char *units, int32_t type, FILE *fp_message)
Checks if a column exists in the SDDS dataset with the specified name, units, and type.
void SDDS_PrintErrors(FILE *fp, int32_t mode)
Prints recorded error messages to a specified file stream.
#define SDDS_FLOAT
Identifier for the float data type.
#define SDDS_LONG
Identifier for the signed 32-bit integer data type.