• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            穩定盈利的期貨交易方法-量化趨勢交易

            alantop -專業量化投資者

            愛好:量化投資,逆向工程,滲透
            隨筆 - 595, 文章 - 0, 評論 - 921, 引用 - 0
            數據加載中……

            檢測文件存在的四種方法。test if a File exist or not?

            1.
            WIN32_FIND_DATA m_data;
            HANDLE hFile;

            hFile=FindFirstFile(filename,&m_data)

            if(hFile==INVALID_HANDLE_VALUE) //file not found

            Make sure you close the handle if the file is found.

            FindClose(hFile);

            2.
            You can use SHGetFileInfo()
            The prototype of the function is as follows:

            DWORD_PTR SHGetFileInfo(
            LPCTSTR pszPath,
            DWORD dwFileAttributes,
            SHFILEINFO *psfi,
            UINT cbFileInfo,
            UINT uFlags
            );


            3.
            PathFileExists

            4. 加一個標準c庫函數

            Example

            /* ACCESS.C: This example uses _access to check the
             * file named "ACCESS.C" to see if it exists and if
             * writing is allowed.
             */
            
            #include? <io.h>
            #include? <stdio.h>
            #include? <stdlib.h>
            
            void main( void )
            {
             ? /* Check for existence */
             ? if( (_access( "ACCESS.C", 0 )) != -1 )
             ? {
             ???? printf( "File ACCESS.C exists\n" );
             ???? /* Check for write permission */
             ???? if( (_access( "ACCESS.C", 2 )) != -1 )
             ??????? printf( "File ACCESS.C has write permission\n" );
             ? }
            }
            

            posted on 2006-05-10 14:14 AlanTop 閱讀(4086) 評論(4)  編輯 收藏 引用 所屬分類: C++

            評論

            # re: 檢測文件存在的三種方法。test if a File exist or not?  回復  更多評論   

            竟然都沒有一個是用標準API的?
            access
            2006-05-11 11:56 | 音樂蟲子

            # re: 檢測文件存在的三種方法。test if a File exist or not?  回復  更多評論   

            正想說呢,結果被樓上先說了。:)

            看來M$的宣傳到位啊。這么多難用的方法(最后一個還算不錯),樓主都知道了,就是不知道標準C庫的方法。
            2006-05-11 13:25 | 沐楓

            # re: 檢測文件存在的第一種方法種方法。test if a File exist or not?  回復  更多評論   

            為什么我的程序就是不能成功檢測:
            system("md test");
            fp=fopen("test\\test.data","wb");
            if(!fp)
            exit(0);
            fclose(fp);

            //測試FindFirstFile()函數.
            hFind=FindFirstFile((LPCWSTR)"test\\test.data",&FindFileData);
            printf("%x",hFind);
            printf("\n%x",INVALID_HANDLE_VALUE);
            FindClose(hFind);
            結果總是 ffffffff
            ffffffff
            文件存在,但用FindFirstFile()卻檢測不成功.
            2007-09-05 10:51 | 胡濱

            # re: 檢測文件存在的四種方法。test if a File exist or not?[未登錄]  回復  更多評論   

            hFind=FindFirstFile((LPCWSTR)"test\\test.data",&FindFileData);

            改用絕對路徑 看看?
            2009-06-11 11:26 | haha
            国产亚洲精品久久久久秋霞 | 亚洲国产精品高清久久久| 无码人妻少妇久久中文字幕| 亚洲美日韩Av中文字幕无码久久久妻妇 | 国产午夜电影久久| 久久久久无码精品国产app| 一本久久综合亚洲鲁鲁五月天| 精品综合久久久久久98| 91久久九九无码成人网站| 久久久高清免费视频| 国产美女久久精品香蕉69| 色天使久久综合网天天| 久久久久久综合一区中文字幕| 亚洲综合久久夜AV | 伊人热人久久中文字幕| 欧洲人妻丰满av无码久久不卡 | 久久亚洲AV无码精品色午夜| 2021久久精品国产99国产精品| 伊人久久成人成综合网222| 91性高湖久久久久| 久久中文骚妇内射| 欧美日韩精品久久久免费观看| 精品久久久久久久久久中文字幕 | 99久久精品国产一区二区| 香蕉久久影院| 久久福利片| 久久精品成人免费观看97| 久久精品国产亚洲沈樵| 久久精品国产亚洲av日韩 | 国产美女久久久| 成人久久久观看免费毛片| 日韩精品久久久久久久电影蜜臀 | 亚洲精品午夜国产va久久| 久久久久香蕉视频| 久久久久综合国产欧美一区二区| 久久精品国产网红主播| 久久偷看各类wc女厕嘘嘘| 久久午夜无码鲁丝片| 国内精品久久国产大陆| 青青国产成人久久91网| 国产精品熟女福利久久AV|