I/O

Defintions file for input/output operations.

Author

Venkata Mukund Kashyap Yedunuthala

Date

23 January 2024

Functions

void get_file_data(std::ifstream &inputFile, unsigned int &numberOfRows, unsigned int &numberOfCols, unsigned short int &maxGrayVal, std::stringstream &strStream)

Reads data from a PGM format image file.

Parameters:
  • inputFile – Input file stream.

  • numberOfRows – Stores number of rows from the file.

  • numberOfCols – Stores number of columns from the file.

  • maxGrayval – Stores maximum value from the file.

  • strStream – Input string stream.

void write_to_file(int *&array, unsigned int &rows, unsigned int &cols, unsigned short int &maxValue, std::string &fileName)

Writes an array to a PGM (P2) file.

Parameters:
  • array – Array to be written to file.

  • rows – Number of rows to be written.

  • cols – Number of cols to be written.

  • maxValue – Maximum value in file.

  • fileName – File name string.