반응형
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#include <iostream>
#include <windows.h>
#include <locale.h>
using namespace std;
#define DEB
#define MAX_CHAR_SIZE 256
#ifdef DEB
#define LOG(...) do { _write(file, __VA_ARGS__ ); } while(0)
#else
#define LOG(...) do {} while(0)
#endif
int file;
int main()
{
wcout.imbue(std::locale("kor"));
//int file;
WCHAR buf[256] =L"dddd매크로";
WCHAR buf2[2]={0,};
WORD wd = 0xfeff;
memcpy(buf2, &wd, 2);
wcout<<buf<<endl;
_wsopen_s(&file, L"log.txt", _O_CREAT|_O_WRONLY|_O_TRUNC, _SH_DENYRW, _S_IWRITE );
if(file == -1)
return 1;
LOG(buf2, 2);
LOG(buf, _countof(buf));
_close(file);
return 0;
}
반응형