亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? open.c

?? C標(biāo)準(zhǔn)庫源代碼,能提高對C的理解,不錯的哦
?? C
?? 第 1 頁 / 共 2 頁
字號:
/***
*open.c - file open
*
*       Copyright (c) 1989-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
*       defines _open() and _sopen() - open or create a file
*
*******************************************************************************/

#ifndef _MAC


#include <cruntime.h>
#include <oscalls.h>
#include <msdos.h>
#include <errno.h>
#include <fcntl.h>
#include <internal.h>
#include <io.h>
#include <share.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <mtdll.h>
#include <stdarg.h>
#include <tchar.h>

/***
*int _open(path, flag, pmode) - open or create a file
*
*Purpose:
*       Opens the file and prepares for subsequent reading or writing.
*       the flag argument specifies how to open the file:
*         _O_APPEND -   reposition file ptr to end before every write
*         _O_BINARY -   open in binary mode
*         _O_CREAT -    create a new file* no effect if file already exists
*         _O_EXCL -     return error if file exists, only use with O_CREAT
*         _O_RDONLY -   open for reading only
*         _O_RDWR -     open for reading and writing
*         _O_TEXT -     open in text mode
*         _O_TRUNC -    open and truncate to 0 length (must have write permission)
*         _O_WRONLY -   open for writing only
*         _O_NOINHERIT -handle will not be inherited by child processes.
*       exactly one of _O_RDONLY, _O_WRONLY, _O_RDWR must be given
*
*       The pmode argument is only required when _O_CREAT is specified.  Its
*       flag settings:
*         _S_IWRITE -   writing permitted
*         _S_IREAD -    reading permitted
*         _S_IREAD | _S_IWRITE - both reading and writing permitted
*       The current file-permission maks is applied to pmode before
*       setting the permission (see umask).
*
*       The oflag and mode parameter have different meanings under DOS. See
*       the A_xxx attributes in msdos.inc
*
*       Note, the _creat() function also uses this function but setting up the
*       correct arguments and calling _open(). _creat() sets the __creat_flag
*       to 1 prior to calling _open() so _open() can return correctly. _open()
*       returns the file handle in eax in this case.
*
*Entry:
*       _TSCHAR *path - file name
*       int flag - flags for _open()
*       int pmode - permission mode for new files
*
*Exit:
*       returns file handle of open file if successful
*       returns -1 (and sets errno) if fails
*
*Exceptions:
*
*******************************************************************************/

int __cdecl _topen (
        const _TSCHAR *path,
        int oflag,
        ...
        )
{
        va_list ap;
        int pmode;

        va_start(ap, oflag);
        pmode = va_arg(ap, int);
        va_end(ap);

        /* default sharing mode is DENY NONE */
        return _tsopen(path, oflag, _SH_DENYNO, pmode);
}

/***
*int _sopen(path, oflag, shflag, pmode) - opne a file with sharing
*
*Purpose:
*       Opens the file with possible file sharing.
*       shflag defines the sharing flags:
*         _SH_COMPAT -  set compatability mode
*         _SH_DENYRW -  deny read and write access to the file
*         _SH_DENYWR -  deny write access to the file
*         _SH_DENYRD -  deny read access to the file
*         _SH_DENYNO -  permit read and write access
*
*       Other flags are the same as _open().
*
*       SOPEN is the routine used when file sharing is desired.
*
*Entry:
*       _TSCHAR *path - file to open
*       int oflag -     open flag
*       int shflag -    sharing flag
*       int pmode -     permission mode (needed only when creating file)
*
*Exit:
*       returns file handle for the opened file
*       returns -1 and sets errno if fails.
*
*Exceptions:
*
*******************************************************************************/

int __cdecl _tsopen (
        const _TSCHAR *path,
        int oflag,
        int shflag,
        ...
        )
{

        int fh;                         /* handle of opened file */
        int filepos;                    /* length of file - 1 */
        _TSCHAR ch;                     /* character at end of file */
        char fileflags;                 /* _osfile flags */
        va_list ap;                     /* variable argument (pmode) */
        int pmode;
        HANDLE osfh;                    /* OS handle of opened file */
        DWORD fileaccess;               /* OS file access (requested) */
        DWORD fileshare;                /* OS file sharing mode */
        DWORD filecreate;               /* OS method of opening/creating */
        DWORD fileattrib;               /* OS file attribute flags */
        DWORD isdev;                    /* device indicator in low byte */
        SECURITY_ATTRIBUTES SecurityAttributes;

        SecurityAttributes.nLength = sizeof( SecurityAttributes );
        SecurityAttributes.lpSecurityDescriptor = NULL;

        if (oflag & _O_NOINHERIT) {
            SecurityAttributes.bInheritHandle = FALSE;
            fileflags = FNOINHERIT;
        }
        else {
            SecurityAttributes.bInheritHandle = TRUE;
            fileflags = 0;
        }

        /* figure out binary/text mode */
        if ((oflag & _O_BINARY) == 0)
            if (oflag & _O_TEXT)
                fileflags |= FTEXT;
            else if (_fmode != _O_BINARY)   /* check default mode */
                fileflags |= FTEXT;

        /*
         * decode the access flags
         */
        switch( oflag & (_O_RDONLY | _O_WRONLY | _O_RDWR) ) {

            case _O_RDONLY:         /* read access */
                    fileaccess = GENERIC_READ;
                    break;
            case _O_WRONLY:         /* write access */
                    fileaccess = GENERIC_WRITE;
                    break;
            case _O_RDWR:           /* read and write access */
                    fileaccess = GENERIC_READ | GENERIC_WRITE;
                    break;
            default:                /* error, bad oflag */
                    errno = EINVAL;
                    _doserrno = 0L; /* not an OS error */
                    return -1;
        }

        /*
         * decode sharing flags
         */
        switch ( shflag ) {

            case _SH_DENYRW:        /* exclusive access */
                fileshare = 0L;
                break;

            case _SH_DENYWR:        /* share read access */
                fileshare = FILE_SHARE_READ;
                break;

            case _SH_DENYRD:        /* share write access */
                fileshare = FILE_SHARE_WRITE;
                break;

            case _SH_DENYNO:        /* share read and write access */
                fileshare = FILE_SHARE_READ | FILE_SHARE_WRITE;
                break;

            default:                /* error, bad shflag */
                errno = EINVAL;
                _doserrno = 0L; /* not an OS error */
                return -1;
        }

        /*
         * decode open/create method flags
         */
        switch ( oflag & (_O_CREAT | _O_EXCL | _O_TRUNC) ) {
            case 0:
            case _O_EXCL:                   // ignore EXCL w/o CREAT
                filecreate = OPEN_EXISTING;
                break;

            case _O_CREAT:
                filecreate = OPEN_ALWAYS;
                break;

            case _O_CREAT | _O_EXCL:
            case _O_CREAT | _O_TRUNC | _O_EXCL:
                filecreate = CREATE_NEW;
                break;

            case _O_TRUNC:
            case _O_TRUNC | _O_EXCL:        // ignore EXCL w/o CREAT
                filecreate = TRUNCATE_EXISTING;
                break;

            case _O_CREAT | _O_TRUNC:
                filecreate = CREATE_ALWAYS;
                break;

            default:
                // this can't happen ... all cases are covered
                errno = EINVAL;
                _doserrno = 0L;
                return -1;
        }

        /*
         * decode file attribute flags if _O_CREAT was specified
         */
        fileattrib = FILE_ATTRIBUTE_NORMAL;     /* default */

        if ( oflag & _O_CREAT ) {
                /*
                 * set up variable argument list stuff
                 */
                va_start(ap, shflag);
                pmode = va_arg(ap, int);
                va_end(ap);

                if ( !((pmode & ~_umaskval) & _S_IWRITE) )
                        fileattrib = FILE_ATTRIBUTE_READONLY;
        }

        /*
         * Set temporary file (delete-on-close) attribute if requested.
         */
        if ( oflag & _O_TEMPORARY ) {
            fileattrib |= FILE_FLAG_DELETE_ON_CLOSE;
            fileaccess |= DELETE;
        }

        /*
         * Set temporary file (delay-flush-to-disk) attribute if requested.
         */
        if ( oflag & _O_SHORT_LIVED )
            fileattrib |= FILE_ATTRIBUTE_TEMPORARY;

        /*
         * Set sequential or random access attribute if requested.
         */
        if ( oflag & _O_SEQUENTIAL )
            fileattrib |= FILE_FLAG_SEQUENTIAL_SCAN;
        else if ( oflag & _O_RANDOM )
            fileattrib |= FILE_FLAG_RANDOM_ACCESS;

        /*
         * get an available handle.
         *
         * multi-thread note: the returned handle is locked!
         */
        if ( (fh = _alloc_osfhnd()) == -1 ) {
            errno = EMFILE;         /* too many open files */
            _doserrno = 0L;         /* not an OS error */
            return -1;              /* return error to caller */
        }

        /*
         * try to open/create the file
         */
        if ( (osfh = CreateFile( (LPTSTR)path,
                                 fileaccess,
                                 fileshare,
                                 &SecurityAttributes,
                                 filecreate,
                                 fileattrib,
                                 NULL ))
             == (HANDLE)0xffffffff )
        {
            /*
             * OS call to open/create file failed! map the error, release
             * the lock, and return -1. note that it's not necessary to
             * call _free_osfhnd (it hasn't been used yet).
             */
            _dosmaperr(GetLastError());     /* map error */
            _unlock_fh(fh);
            return -1;                      /* return error to caller */
        }

        /* find out what type of file (file/device/pipe) */
        if ( (isdev = GetFileType(osfh)) == FILE_TYPE_UNKNOWN ) {
            CloseHandle(osfh);
            _dosmaperr(GetLastError());     /* map error */
            _unlock_fh(fh);
            return -1;
        }

        /* is isdev value to set flags */
        if (isdev == FILE_TYPE_CHAR)
            fileflags |= FDEV;
        else if (isdev == FILE_TYPE_PIPE)
            fileflags |= FPIPE;

        /*
         * the file is open. now, set the info in _osfhnd array
         */
        _set_osfhnd(fh, (long)osfh);

        /*
         * mark the handle as open. store flags gathered so far in _osfile
         * array.
         */
        fileflags |= FOPEN;
        _osfile(fh) = fileflags;

        if ( !(fileflags & (FDEV|FPIPE)) && (fileflags & FTEXT) &&
             (oflag & _O_RDWR) )
        {
            /* We have a text mode file.  If it ends in CTRL-Z, we wish to
               remove the CTRL-Z character, so that appending will work.
               We do this by seeking to the end of file, reading the last
               byte, and shortening the file if it is a CTRL-Z. */

            if ((filepos = _lseek_lk(fh, -1, SEEK_END)) == -1) {
                /* OS error -- should ignore negative seek error,
                   since that means we had a zero-length file. */
                if (_doserrno != ERROR_NEGATIVE_SEEK) {
                    _close(fh);
                    _unlock_fh(fh);
                    return -1;
                }
            }
            else {
                /* Seek was OK, read the last char in file. The last
                   char is a CTRL-Z if and only if _read returns 0
                   and ch ends up with a CTRL-Z. */
                ch = 0;
                if (_read_lk(fh, &ch, 1) == 0 && ch == 26) {
                    /* read was OK and we got CTRL-Z! Wipe it
                       out! */
                    if (_chsize_lk(fh,filepos) == -1)
                    {
                        _close(fh);
                        _unlock_fh(fh);
                        return -1;
                    }
                }

                /* now rewind the file to the beginning */
                if ((filepos = _lseek_lk(fh, 0, SEEK_SET)) == -1) {
                    _close(fh);
                    _unlock_fh(fh);
                    return -1;
                }
            }
        }

        /*
         * Set FAPPEND flag if appropriate. Don't do this for devices or pipes.
         */
        if ( !(fileflags & (FDEV|FPIPE)) && (oflag & _O_APPEND) )
            _osfile(fh) |= FAPPEND;

        _unlock_fh(fh);                 /* unlock handle */

        return fh;                      /* return handle */
}


#else  /* _MAC */


#include <cruntime.h>
#include <internal.h>
#include <string.h>
#include <memory.h>
#include <msdos.h>
#include <errno.h>
#include <fcntl.h>
#include <macos\files.h>
#include <string.h>
#include <macos\errors.h>
#include <macos\types.h>
#include <io.h>
#include <share.h>
#include <stdlib.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <stdarg.h>

/* define the entry in terminator table */

#pragma data_seg(".CRT$XTX")

_PVFV pendlowio = _endlowio;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲影视在线观看| 久久精品国产第一区二区三区| 在线不卡中文字幕| 国产成人精品亚洲日本在线桃色| 亚洲欧美日韩国产综合在线| 九九九久久久精品| 一片黄亚洲嫩模| 国产欧美精品一区二区色综合| 欧美日韩国产高清一区二区三区| 波多野结衣的一区二区三区| 麻豆精品一区二区av白丝在线| 亚洲免费毛片网站| 欧美国产精品一区二区三区| 欧美一级xxx| 欧美性感一区二区三区| 丁香激情综合国产| 国内精品国产成人| 日韩中文字幕av电影| 亚洲美女电影在线| 国产精品国产自产拍在线| 精品久久人人做人人爱| 欧美精品一卡两卡| 欧美性三三影院| 在线观看av一区二区| 99精品欧美一区二区三区小说 | 精品写真视频在线观看| 午夜在线成人av| 一区二区在线观看免费| 国产日产欧产精品推荐色| 欧美电视剧免费观看| 日韩一二在线观看| 在线播放/欧美激情| 欧美日韩一区二区三区在线看| 99精品久久只有精品| 91在线码无精品| 99久久久精品| 91免费看视频| 99精品一区二区三区| 91一区二区在线观看| 91女厕偷拍女厕偷拍高清| 99re这里只有精品首页| 95精品视频在线| 91欧美一区二区| 欧美午夜影院一区| 欧美日本乱大交xxxxx| 91麻豆精品国产91久久久久| 欧美巨大另类极品videosbest| 在线观看av一区二区| 欧美精品久久99| 日韩一区二区三区电影在线观看 | 精品盗摄一区二区三区| 精品久久久三级丝袜| 精品国产91乱码一区二区三区| 久久先锋影音av| 国产精品乱码一区二三区小蝌蚪| 国产精品素人一区二区| 亚洲精品国产精华液| 午夜av区久久| 六月婷婷色综合| 粉嫩av一区二区三区在线播放| 92精品国产成人观看免费| 欧美亚洲图片小说| 日韩一区二区在线观看| 亚洲精品在线电影| 国产精品家庭影院| 亚洲一区在线电影| 蜜桃视频第一区免费观看| 国产美女av一区二区三区| 成人福利在线看| 欧洲国内综合视频| 欧美v日韩v国产v| 中文字幕精品一区| 亚洲第一福利一区| 国产麻豆精品theporn| 一本色道**综合亚洲精品蜜桃冫| 制服丝袜中文字幕亚洲| 中文字幕av一区二区三区免费看| 一区二区三区四区中文字幕| 免费的成人av| gogogo免费视频观看亚洲一| 欧美美女bb生活片| 欧美激情一区二区三区四区| 亚洲高清不卡在线观看| 国产高清成人在线| 欧美日韩一区久久| 国产午夜亚洲精品理论片色戒| 一区二区不卡在线播放 | 一区二区三区在线视频免费| 日本成人在线看| av成人免费在线| 日韩欧美成人一区| 亚洲黄色小视频| 精品综合久久久久久8888| 色婷婷一区二区三区四区| 2020国产精品久久精品美国| 一区二区三区不卡视频在线观看| 国产一区二区三区香蕉| 欧美日产国产精品| 成人欧美一区二区三区在线播放| 精品在线播放免费| 欧美亚州韩日在线看免费版国语版| 精品sm捆绑视频| 亚洲高清不卡在线| 91视频免费播放| 欧美激情一区二区三区四区| 久久精品国产第一区二区三区| 欧美日韩一区二区在线视频| 亚洲视频一区在线观看| 福利一区在线观看| 精品日韩一区二区| 奇米一区二区三区av| 欧美羞羞免费网站| 亚洲精品美国一| av不卡在线播放| 国产欧美一区二区精品性色| 美女高潮久久久| 91麻豆精品91久久久久同性| 亚洲永久免费视频| 在线一区二区三区四区五区| 国产精品丝袜91| 国产盗摄一区二区| 国产婷婷色一区二区三区在线| 另类小说图片综合网| 日韩一二在线观看| 欧美bbbbb| 日韩一区二区高清| 日本一区中文字幕 | 26uuu国产在线精品一区二区| 日日夜夜一区二区| 欧美精品粉嫩高潮一区二区| 亚洲观看高清完整版在线观看| 色噜噜偷拍精品综合在线| 中文字幕亚洲不卡| 91色porny| 亚洲精品美腿丝袜| 欧美亚洲国产一区在线观看网站| 伊人性伊人情综合网| 在线日韩av片| 亚洲超丰满肉感bbw| 欧美日韩色一区| 日本中文字幕不卡| 欧美videossexotv100| 激情综合网最新| 国产亚洲一区二区三区在线观看| 国产一区999| 最新高清无码专区| 日本大香伊一区二区三区| 一区二区三区欧美日韩| 欧美丝袜自拍制服另类| 日韩黄色免费电影| 欧美成人性战久久| 国产成人丝袜美腿| 亚洲人成网站精品片在线观看| 日本久久一区二区三区| 天堂在线一区二区| 久久综合九色综合97婷婷女人| 国产精品18久久久久久久网站| 欧美激情一区二区三区不卡| 一本一道波多野结衣一区二区| 亚洲自拍欧美精品| 日韩欧美二区三区| 成人美女在线视频| 亚洲伊人伊色伊影伊综合网| 欧美一级片在线看| 成人av在线资源网| 亚洲一级二级三级| 精品国产青草久久久久福利| 成人午夜激情片| 午夜精品免费在线| 26uuu亚洲| 色又黄又爽网站www久久| 五月天一区二区三区| 久久精品一区四区| 欧美影院精品一区| 久久99精品国产91久久来源| 国产精品久久久爽爽爽麻豆色哟哟| 日本久久电影网| 国产一区二区三区免费观看| 亚洲另类中文字| 精品福利av导航| 在线观看日韩国产| 国产乱码精品一区二区三区五月婷| ...中文天堂在线一区| 日韩一区二区在线观看| av一区二区三区四区| 另类小说综合欧美亚洲| 亚洲柠檬福利资源导航| 欧美va亚洲va| 欧美最新大片在线看| 国产成人在线视频播放| 日韩高清在线不卡| 亚洲人成在线观看一区二区| 精品免费日韩av| 欧美视频一区二区在线观看| 国产福利一区二区| 日本不卡123| 一区二区三区小说| 国产精品视频免费| 欧美精品一区二| 91精品国产综合久久精品app|