Skip to main content

open_csv_for_channel

Function open_csv_for_channel 

Source
pub(crate) fn open_csv_for_channel(
    out_dir: &Path,
    asset: u32,
    ch_token: &str,
) -> Result<File>
Expand description

Opens or creates the per-channel CSV file and writes its header if needed.

The file is <out_dir>/labjack_<asset>_<ch_token>.csv, with the asset formatted by subjects::pad_asset, and is opened for appending. The header sequence,timestamp,raw_value is written when the file did not exist or is empty.

§Arguments

  • out_dir - Output directory; must already exist.
  • asset - Asset number used in the file name.
  • ch_token - Channel token from the subject, for example ch03.

§Errors

Returns an error if the file cannot be opened or created, its metadata cannot be read, or the header cannot be written.