Skip to content
Snippets Groups Projects
Commit c9280b56 authored by Paul Albrecht's avatar Paul Albrecht
Browse files

Upload New File

parent 6fb40fcf
No related branches found
No related tags found
No related merge requests found
/********************************************************************************
* CIS3(D) Program suite *
* *
* file: ops_io.cc *
* *
* contains io routines *
* *
* Tillmann Klamroth 2005 *
********************************************************************************/
#include <fstream>
#include <math.h>
#include <limits.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <iostream>
#include <sstream>
#include <stdlib.h>
using namespace std;
//Functions
void status(ofstream* outf);
int rem_com(char* filename, char* streamstring, int string_length);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* STATUS */
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void status(ofstream* outf){
char str1[1024];
size_t len = 1024;
time_t curr_time;
time(&curr_time);
gethostname(str1, len);
*outf << "Host: " << str1 << ", Date: " << ctime(&curr_time);
outf->flush();
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* REM COM */
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
int rem_com(char* filename, char* streamstring, int string_length){
const char com_B = '#';
const char com_E = '\n';
int pos = 0;
char cc;
ifstream inf(filename);
while(inf.get(cc)&& pos < string_length-1){
if(cc != com_B)
streamstring[pos++] = cc;
else{
while(cc != com_E && inf.get(cc));
streamstring[pos++] = com_E;
}
}
streamstring[pos] = 0;
if(pos == string_length-1){
cerr << "Buffer size exceeded !\n"; exit(0);
}
return(strlen(streamstring));
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* get_sys_size(char* sysfile, int* nroao, int* nroa, */
/* long long int* nrofint) */
/* */
/* Read the system sizes form sysfile. */
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void get_sys_size(char* sysfile, int* nroao, int* nroa, long long int* nrofint){
ifstream inf(sysfile);
inf.read((char *) nroao, sizeof(int));
inf.read((char *) nroa, sizeof(int));
inf.read((char *) nrofint, sizeof(long long int));
inf.close();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment