[問題] CFileFind print問題?
//想問為什麼cout<<PATH會變成011E2FAB像是其它進制的表示??
//
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include <fstream>
#include <string>
#include <tchar.h>
#include <afx.h>
#include <iostream>
#include <stdio.h>
//首先我載入了這些標頭檔
using namespace std;
CFileFind finder;
static const TCHAR szFileToFind[] = _T("C:\\WINDOWS\\SYSTEM.INI");
void main(){
BOOL bResult = finder.FindFile(szFileToFind);
if (bResult)
{
finder.FindNextFileW();
///////////////////////////////////////////////////我的Print指令
cout << "Root of " << szFileToFind;
cout << " is " << (LPCTSTR)finder.GetRoot();
cout << endl;
///////////////////////////////////////////////////我的Print指令
finder.Close();
}
else
cout << "You have no " << szFileToFind << " file." << endl;
getchar();
}
//我最後執行輸出變成:
//Root of 011E2FAB is 005165D0
//照理來說是不是要像下面:
//Root of C:\WINDOWS\SYSTEM.INI is C:\WINDOWS
//?
//------------------環境-------------------------------------
//1.我使用的是VC 2013 (VC2010我也試過了)
//2.property ->configuration property->general ->use of MFC
// 我有改成->Use MFC in a Shared DLL
//---------------------------------------------------------
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.141.147.182
→
12/11 22:03, , 1F
12/11 22:03, 1F
→
12/11 22:06, , 2F
12/11 22:06, 2F
TRACE(_T("Name of %s is %s\n"), szFileToFind,
(LPCTSTR)finder.GetFileName());
我改成這樣變成沒有顯示任何東西
※ 編輯: wowrz 來自: 220.141.147.182 (12/11 22:10)
→
12/11 22:09, , 3F
12/11 22:09, 3F
→
12/11 22:10, , 4F
12/11 22:10, 4F
→
12/11 22:10, , 5F
12/11 22:10, 5F
→
12/11 22:11, , 6F
12/11 22:11, 6F
→
12/11 22:11, , 7F
12/11 22:11, 7F
→
12/11 22:12, , 8F
12/11 22:12, 8F
→
12/11 22:14, , 9F
12/11 22:14, 9F
→
12/11 22:15, , 10F
12/11 22:15, 10F
→
12/11 22:16, , 11F
12/11 22:16, 11F
→
12/11 22:16, , 12F
12/11 22:16, 12F
→
12/11 22:17, , 13F
12/11 22:17, 13F
→
12/11 22:18, , 14F
12/11 22:18, 14F
原來是Property->configuration property ->Character Set要選 Use Multi-BYTE
Character set...
應該是我之前不小心動到
※ 編輯: wowrz 來自: 220.141.147.182 (12/11 22:35)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章