Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Text Records

Text records store arbitrary string data in a DSS file.

Writing Text

#![allow(unused)]
fn main() {
use dss_core::NativeDssFile;

let mut dss = NativeDssFile::create("notes.dss")?;
dss.write_text("/PROJECT/SITE/NOTE///COMMENT/", "Dam inspection completed 01Jan2020")?;
dss.write_text("/PROJECT/SITE/NOTE///DESCRIPTION/", "Multi-line text\nLine 2\nLine 3")?;
}

Python:

with hecdss_rs.DssFile.create("notes.dss") as dss:
    dss.write_text("/PROJECT/SITE/NOTE///COMMENT/", "Dam inspection completed")

Reading Text

#![allow(unused)]
fn main() {
if let Some(text) = dss.read_text("/PROJECT/SITE/NOTE///COMMENT/")? {
    println!("Note: {text}");
} else {
    println!("Record not found");
}
}

Python:

text = dss.read_text("/PROJECT/SITE/NOTE///COMMENT/")
if text is not None:
    print(f"Note: {text}")

Notes

  • Returns None (Rust Option) / None (Python) if the pathname doesn’t exist
  • Text records use DSS type code 300
  • Maximum text size is limited by available disk space
  • Pathname must follow the /A/B/C/D/E/F/ format