📄 file.h
字号:
/* * File.h * File I/O utilities for LM * * Copyright (c) 1995, SRI International. All Rights Reserved. * * @(#)$Header: /home/srilm/devel/misc/src/RCS/File.h,v 1.9 2006/01/05 19:32:42 stolcke Exp $ * */#ifndef _File_h_#define _File_h_#include <stdio.h>#include <iostream>using namespace std;const unsigned int maxWordsPerLine = 50000;extern const char *wordSeparators;typedef FILE * FILEptr;/* * A File object is a wrapper around a stdio FILE pointer. If presently * provides two kinds of convenience. * * - constructors and destructors manage opening and closing of the stream. * The stream is checked for errors on closing, and the default behavior * is to exit() with an error message if a problem was found. * - the getline() method strips comments and keeps track of input line * numbers for error reporting. * * File object can be cast to (FILE *) to perform most of the standard * stdio operations in a seamless way. */class File{public: File(const char *name, const char *mode, int exitOnError = 1); File(FILE *fp = 0, int exitOnError = 1); ~File(); char *getline(); int close(); int error() { return (fp == 0) || ferror(fp); }; operator FILEptr() { return fp; }; ostream &position(ostream &stream = cerr); const char *name; unsigned int lineno; int exitOnError;private: FILE *fp; char *buffer; unsigned bufLen;};#endif /* _File_h_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -