我正在尝试将缓冲区输出到位于我的桌面的文件“z.txt”中。我在 win32(visual c++)中执行此操作的语法是 -
memcpy(HtmlFileContents,&Buffer[location],HtmlFileLength);//i have the contents in HtmlFileContents
//which i have to display in the file "z.txt"
FILE *stream ;
errno_t err;
err=fopen_s(&stream, "C:\\Users\\sshekha\\Desktop\\z.txt","w");//err gives error 13
// when in write mode but when in read mode it opens the file
if( err == 0 )
{
MessageBox(m_hwndPreview,L" the file is opened ",L"BTN WND",MB_ICONINFORMATION);
}
else
{
MessageBox(m_hwndPreview,L" the file is not opened ",L"BTN WND",MB_ICONINFORMATION);
}
谁能告诉我为什么这样做???