|
SDDS ToolKit Programs and Libraries for C and Python
|
Contains the implementation of the fixcount function to update data point counts in a file.
This file provides functionality to adjust the number of data points recorded in a file by either counting the actual data points or setting it to a specified value. It is intended for use with data files that follow a specific format, excluding SDDS files.
Definition in file fixcounts.c.
#include "mdb.h"#include "table.h"#include <ctype.h>Go to the source code of this file.
Functions | |
| int | fixcount (char *filename, long n_points) |
| Updates the data point count in a specified file. | |
| int fixcount | ( | char * | filename, |
| long | n_points ) |
Updates the data point count in a specified file.
Function: fixcount
The fixcount function reads a file and updates the count of data points at a specific location within the file. If n_points is -1, it counts the actual number of data points in the file, excluding lines that start with '!' (comment lines). Otherwise, it uses the provided n_points value. The function then writes the count back into the file at a predetermined position, ensuring the count fits within the allocated space.
The function skips updating files that start with "SDDS" followed by a digit, returning -1 in such cases.
| filename | The path to the file whose data point count is to be updated. |
| n_points | The number of data points to set in the file. If -1, the function will count the data points by reading the file. |
Definition at line 33 of file fixcounts.c.