求教:为何文件生不成
按照书上写的,编译无错误,但运行后应生成的文件没有生成,找不到,请各位高手帮忙# include <fstream.h>
# include <iostream>struct Date
{
int iMonth,iDay,iYear;
};
struct Product
{
int iPartNumber;
char szName[80];
double dPrice;
};
struct Custom
{
int iID;
char szName[50];
char szAddress[50];
char szCity[20];
char szState[20];
char szZip[9];
};
void main()
{Date dt={6,10,92};
Product prod={122,"Vegamatic",19.95};
Customer cust={15,"David Rose","300 road","Newyork","USA","123456");
ofstream datafile("data.dat");
datafile.write((char*)&dt,sizeof dt);
datafile.write((char*)&prod,sizeof prod);
datafile.write((char*)&cust,sizeof cust);
}