⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pinfile.cxx

📁 PTypes (C++ Portable Types Library) is a simple alternative to the STL that includes multithreading
💻 CXX
字号:
/* * *  C++ Portable Types Library (PTypes) *  Version 1.7.5   Released 9-Mar-2003 * *  Copyright (c) 2001, 2002, 2003 Hovik Melikyan * *  http://www.melikyan.com/ptypes/ *  http://ptypes.sourceforge.net/ * */#ifdef WIN32#  include <windows.h>#else#  include <fcntl.h>#  include <unistd.h>#endif#include "pstreams.h"PTYPES_BEGINinfile::infile()    : instm(), filename(), syshandle(invhandle), peerhandle(invhandle)  {}infile::infile(const char* ifn)    : instm(), filename(ifn), syshandle(invhandle), peerhandle(invhandle)  {}infile::infile(const string& ifn)    : instm(), filename(ifn), syshandle(invhandle), peerhandle(invhandle)  {}infile::~infile() {    close(); }int infile::classid(){    return CLASS_INFILE;}string infile::get_streamname() {    return filename;}void infile::doopen() {    if (syshandle != invhandle)        handle = syshandle;    else    {#ifdef WIN32        SECURITY_ATTRIBUTES sa;        sa.nLength = sizeof(SECURITY_ATTRIBUTES);        sa.lpSecurityDescriptor = NULL;        sa.bInheritHandle = TRUE;        handle = int(CreateFile(filename, GENERIC_READ,            FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, OPEN_EXISTING,             FILE_FLAG_SEQUENTIAL_SCAN, 0));#else        handle = ::open(filename, O_RDONLY);#endif        if (handle == invhandle)            error(uerrno(), "Couldn't open");    }}void infile::doclose(){    instm::doclose();    syshandle = invhandle;    peerhandle = invhandle;}PTYPES_END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -