我正在尝试创建一个顺序文件,但它似乎不起作用。谁能解释如何让它在 MS Visual Studio 2010 中工作?
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
ofstream outClientFile( "clients.dat", ios::out);
if (!outClientFile)
{
cerr << "File could not be opened" << endl;
exit(1);
}
cout << "Enter the Appointment Date, Time, Duration, Name," << endl
<< "Description, Contact Name, and Contact Number.\n? ";
int appDate, appTime, appContactNum;
string appName, appDescription, appContactName;
double appDuration;
while ( cin >> appDate >> appTime >> appDuration >>
appName >> appDescription >> appContactName >> appContactNum )
{
outClientFile << appDate << ' ' << appTime << ' ' << appDuration << ' ' << appName << ' ' << appDescription << ' ' << appContactName << ' ' << appContactNum << endl;
cout << "? ";
}
}
这是我输入一行后的输出。
Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
The program '[452] CSC275 Assignment 3.exe: Native' has exited with code 0 (0x0).