C++相談室 part81
■ このスレッドは過去ログ倉庫に格納されています
0455448
2010/05/22(土) 23:59:51出力。
3256 実
2974 読み込み
#include <windows.h>
#include <string>
#include <iostream>
#include<io.h>
using namespace std;
int main(){
wstring fn=L"aaaa";
int n;
HANDLE hd=CreateFileW( fn.c_str() , GENERIC_READ , FILE_SHARE_READ , NULL , OPEN_ALWAYS , 0 , NULL);
FILE* fp=_wfdopen( _open_osfhandle ( (intptr_t)hd, 0 ), L"rb" );
fseek(fp,0,SEEK_END);
n=ftell(fp);
cout<<n<<endl;
fseek(fp,0,SEEK_SET);
string s( n,'\0' );
n=fread(&s[0],1,n,fp);
fclose(fp);
cout<<n<<endl;
return 1; }
■ このスレッドは過去ログ倉庫に格納されています