存取資源檔

存取資源檔

How to Access Text File in Resources?


HANDLE hTextResource = LoadResource(AfxGetResourceHandle(),h1);
LPSTR lpResData = (LPSTR)::LockResource( hTextResource );
if( !hTextResource )  
{
   AfxMessageBox("載入txt 失敗");
   return;
}   
FILE *fmlist = fopen("lexdt.txt","w");
fprintf(fmlist,"%s",lpResData);
fclose(fmlist);
FreeResource(hTextResource);
Dotblogs 的標籤: