• <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 閱讀(4091) 評論(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
            欧洲成人午夜精品无码区久久| 欧美丰满熟妇BBB久久久| 亚洲精品tv久久久久久久久| 狠狠色丁香久久婷婷综合_中 | 国产成人精品久久免费动漫| 99热成人精品热久久669| 日本免费久久久久久久网站| 99久久精品费精品国产| 久久婷婷成人综合色综合| 久久93精品国产91久久综合| 久久精品国产精品亚洲精品| 国产美女亚洲精品久久久综合| 狠狠88综合久久久久综合网| 久久久久国产一区二区| 国产成人久久精品激情| 94久久国产乱子伦精品免费| 久久香综合精品久久伊人| 久久se精品一区精品二区国产| 波多野结衣久久精品| 精品国产91久久久久久久a| 日韩一区二区久久久久久| 久久精品国产91久久麻豆自制| 国产精品久久自在自线观看| 久久综合精品国产二区无码| 97视频久久久| 久久99国产综合精品| 亚洲国产成人久久综合碰| 久久久久久亚洲精品无码| 久久久久成人精品无码| 久久影视综合亚洲| 国内精品伊人久久久久影院对白 | 久久久精品波多野结衣| 亚洲精品97久久中文字幕无码| 精品久久久久久中文字幕| 青青青国产成人久久111网站| 精品久久人人做人人爽综合| 欧美精品乱码99久久蜜桃| 国产午夜精品理论片久久影视| 久久影视综合亚洲| 国内精品久久久久影院优| 久久噜噜久久久精品66|