- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# FileUtil Class Reference

class used to make it easy to read and write files. More...

`#include <OSFileUtil.h>`

List of all members.

## Public Member Functions
| FileUtil ()
| the class constructor
| ~FileUtil ()
| the class destructor
std::string | getFileAsString (const char *fname)
| read a file and return contents as a string.
char * | getFileAsChar (const char *fname)
| read a file and return contents as a char pointer.
bool | writeFileFromString (char *fname, std::string thestring)
| write a file from an input string.
bool | writeFileFromString (std::string fname, std::string thestring)
| write a file from an input string.
bool | writeFileFromChar (char *fname, char *ch)
| write a file from an input char pointer.

## Detailed Description

class used to make it easy to read and write files.

Author:
  Robert Fourer, Jun Ma, Kipp Martin

Version:
  1.0, 03/14/2004

Since:
  OS 1.0

Remarks:

The `FileUtil` class contains methods for reading and writing files from strings used by many classes in the Optimization Services (OS) framework.

Definition at line 39 of file OSFileUtil.h.

## Constructor & Destructor Documentation

FileUtil::FileUtil | ( |  | ) |

the class constructor

Definition at line 27 of file OSFileUtil.cpp.

FileUtil::~FileUtil | ( |  | ) |

the class destructor

Definition at line 31 of file OSFileUtil.cpp.

## Member Function Documentation

std::string FileUtil::getFileAsString | ( | const char * | fname | ) |

read a file and return contents as a string.

Parameters:

  | fname | holds the name of the file.

Returns:
  the file contents as a sring.

Definition at line 34 of file OSFileUtil.cpp.

References ErrorClass::errormsg.

Referenced by OS_DipInterface::generateInitialMaster(), main(), OS_tm::readInput(), OS_DipInterface::readOSiL(), and OS_DipInterface::readOSoL().

char * FileUtil::getFileAsChar | ( | const char * | fname | ) |

read a file and return contents as a char pointer.

Parameters:

  | fname | holds the name of the file.

Returns:
  the file contents as a char pointer.

Definition at line 73 of file OSFileUtil.cpp.

References ErrorClass::errormsg.

bool FileUtil::writeFileFromString | ( | char * | fname,
|  | std::string | thestring |
| ) |  |  |

write a file from an input string.

Parameters:

  | fname | holds the name of the file to be written.
  | thestring | holds the string to be written to the file.

Returns:
  true if file successfuly written.

Definition at line 121 of file OSFileUtil.cpp.

References ErrorClass::errormsg.

Referenced by kill(), knock(), main(), retrieve(), send(), and solve().

bool FileUtil::writeFileFromString | ( | std::string | fname,
|  | std::string | thestring |
| ) |  |  |

write a file from an input string.

Parameters:

  | fname | holds the name of the file to be written.
  | thestring | holds the string to be written to the file.

Returns:
  true if file successfuly written.

Definition at line 159 of file OSFileUtil.cpp.

References ErrorClass::errormsg.

bool FileUtil::writeFileFromChar | ( | char * | fname,
|  | char * | ch |
| ) |  |  |

write a file from an input char pointer.

Parameters:

  | fname | holds the name of the file to be written.
  | ch | holds a pointer to a char array to be written to the file.

Returns:
  true if file successfuly written.

Definition at line 187 of file OSFileUtil.cpp.

The documentation for this class was generated from the following files:

- /home/coin/SVN-release/OS-2.3.5/OS/src/OSUtils/OSFileUtil.h
- /home/coin/SVN-release/OS-2.3.5/OS/src/OSUtils/OSFileUtil.cpp