Skip to content

Add fileIO and scanf to Pamgen/RTC

James Willenbring requested to merge jgfouca/rtc_file_io into develop

Created by: jgfouca

Adds fileIO, specifically the readline function to Pamgen's RTC package. Also adds scanf to make the read lines usable.

Description

Example usage:

  int numRead = 0;
  int index = 0;
  while (numRead != -1) {
    char buffer[256];
    numRead = readline("table.dat", buffer);
    if (numRead != -1) {
      scanf(buffer, testCol1[index], testCol2[index], testCol3[index]);
    }
    index = index + 1;
  }

This would read in a file with 3 columns of data into the testColN arrays.

Motivation and Context

Requested by Thomas Smith for Drekar.

How Has This Been Tested?

RTC has a test in Pamgen. I added to that test to test readline and scanf. It passes for both RELEASE and DEBUG builds on rhel6.

Checklist

  • My commit messages mention the appropriate GitHub issue numbers.
  • My code follows the code style of the affected package(s).
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the code contribution guidelines for this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • No new compiler warnings were introduced.
  • These changes break backwards compatibility.

Merge request reports