English 中文(简体)
计算机目标文件产出
原标题:File output on a target computer

我的窗口形式申请使用如下:

ofstream myfile;
myfile.open("foo.csv");
myfile << "whatever";
myfile.close()

档案产出在我计算机上被罚款,而同一目录中申请(编辑后自动取翻)。 然而,如果我把申请移至我的电脑上的另一地点,或者在使用窗户设置档案分发时,再上目标计算机,我就能够拿到文件。 是否有任何人知道如何这样做?

问题回答

它应当在任何计算机上进行罚款。

两种可能的原因:

(1) 出现错误,使档案无法书写,或

2) 在你预计会收到档案时,档案没有书写。

明确检查错误。 例如:

std::ofstream outFile("foo.csv");
if (!outFile)
{
   // Open failed - take error handling action.
}

ADDENDUM: 这印有错误信息:

std::ofstream outFile("foo.csv");
if (!outFile)
{
   // Open failed - take error handling action.
   cout << "error reading file foo.csv" << " error: " << strerror(errno) << endl;
}




相关问题
how to reliable capture display setting changed

static void Main() { // Set the SystemEvents class to receive event notification when a user // when display settings change. SystemEvents.DisplaySettingsChanged += new ...

Why use CComBSTR instead of just passing a WCHAR*?

I m new to COM. What exactly is the advantage of replacing: L"String" with CComBSTR(L"String") I can see a changelist in the COM part of my .NET application where all strings are replaced in this ...

COM Basic links

folks can you provide me the tutorial link or .pdf for learning basic COM?. i do google it.. still i recommend answers of stackoverflow so please pass me.. Thanks

Statically linking Winsock?

I m using Winsock 1.1 in my project. I include wsock32.lib in "Additional Dependencies". I m looking at the DLL project using depends.exe and notice that the DLL depends on wsock32.dll. How can I ...

热门标签