Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "mcstats.h" | |
| #include <assert.h> | |
| #include <stdlib.h> | |
| //#include <stdio> | |
| #include <iostream> | |
| #include <fstream> | |
| #include <string> | |
| using std::cout; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const char white[] = " \t\r"; | |
| string trim(string& str) | |
| { | |
| if(str.length() ==0) { return str;} | |
| size_t first = str.find_first_not_of(white); | |
| if(first == string::npos) return ""; | |
| size_t last = str.find_last_not_of(white); | |
| return str.substr(first, (last-first+1)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <sys/stat.h> | |
| ... | |
| struct stat st; | |
| stat("s2/yfetch.csv", &st); | |
| time_t t = st.st_mtime; | |
| struct tm atm; | |
| localtime_r(&t, &atm); | |
| char dtstamp[80]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Desktop Entry] | |
| Version=0.0.0 | |
| Type=Application | |
| Name=Xterm Terminal | |
| GenericName=Xterm Terminal | |
| Comment=A lightweight terminal | |
| Icon=/usr/share/icons/nuoveXT2/22x22/apps/terminal.png | |
| Exec=xterm %F | |
| #Terminal=false | |
| MimeType=text/html; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> // std::cout | |
| #include <fstream> // std::ifstream | |
| #include <string> | |
| void reading() | |
| { | |
| std::string filename = ... ; | |
| std::ifstream ifs; | |
| if(filename.size()>0) ifs.open(filename); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <fstream> | |
| #include <iostream> | |
| void prin_vecvec(vecvec_t & vvs, const char *sep, const char *recsep, const char *filename ) | |
| { | |
| std::ofstream ofs; | |
| bool use_file = strlen(filename); | |
| if(use_file) ofs.open(filename, std::ofstream::out); | |
| ostream &os = use_file ? ofs : cout ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 000100 identification division. | |
| 000200 program-id. naps. | |
| 000300 environment division. | |
| INPUT-OUTPUT SECTION. | |
| FILE-CONTROL. | |
| SELECT EPICS-FILE ASSIGN TO | |
| "/home/mcarter/.mca/work/s3/epics.rep" | |
| ORGANIZATION IS LINE SEQUENTIAL. | |
| select sectors-file assign to | |
| "sectors.txt" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| std::string dout(double d) | |
| { | |
| std::ostringstream s; | |
| s.precision(2); | |
| s.width(10); | |
| s << std::fixed; | |
| s << d; | |
| return s.str(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <fstream> | |
| #include <sstream> | |
| std::string slurp(const char *filename) | |
| { | |
| std::ifstream in; | |
| in.open(filename, std::ifstream::in | std::ifstream::binary); | |
| std::stringstream sstr; | |
| sstr << in.rdbuf(); | |
| in.close(); |