Files
lammps/tools/phonon/input.cpp
2023-05-01 20:14:52 -04:00

36 lines
1004 B
C++

#include "input.h"
#include "global.h"
/* -------------------------------------------------------------------
* Constructor. If flag = 1, output user inputs as script.inp
* ---------------------------------------------------------------- */
UserInput::UserInput(int flag)
{
fp = NULL;
if (flag) fp = fopen("script.inp", "w");
return;
}
/* -------------------------------------------------------------------
* Deconstructor. Output user inputs as required and clear workspace.
* ---------------------------------------------------------------- */
UserInput::~UserInput()
{
if (fp) fclose(fp);
fp = NULL;
}
/* -------------------------------------------------------------------
* Read stdin and keep a record of it.
* ---------------------------------------------------------------- */
void UserInput::read_stdin(char *str)
{
fgets(str, MAXLINE, stdin);
if (fp) fprintf(fp, "%s", str);
return;
}
/* ---------------------------------------------------------------- */