In addition to the code below, what should I write in order to read those savings??
#include <windows.h>
#include <ole2.h>
struct Date
{
int iMonth, iDay, iYear;
};
struct Product
{
int iPartNumber;
char szName[80];
double dPrice;
};
struct Customer
{
int iID;
char szName[50];
char szAddress[50];
char szCity[20];
char szState[20];
char szZip[9];
};
void main()
{
Date dt = { 7, 11, 1998 };
Product prod = {122, "XXX", 19.95};
Customer cust = {15, "John Daniels", "304 Oak Street","Boring", "Oregon", "97205"};
IStorage * pRootStorage;
IStream * pOrderInfo;
CoInitialize(NULL);
StgCreateDocfile(L"data.dat", STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0, &pRootStorage);
pRootStorage->CreateStream(L"Order Info", STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pOrderInfo);
pOrderInfo->Write(&dt, sizeof(dt), NULL);
pOrderInfo->Write(&prod, sizeof(prod), NULL);
pOrderInfo->Write(&cust, sizeof(cust), NULL);
pOrderInfo->Release();
pRootStorage->Release();
CoUninitialize();
}
Could you give me a link or a clue to a good tutorial on WRITING and READING
OLE Structured Storage files? (Please, don't tell me that there is a MSDN, 'cause it
doesn't help me too much, it's dizzy, it has many links and I usually loose the right path
among them)
#include <windows.h>
#include <ole2.h>
struct Date
{
int iMonth, iDay, iYear;
};
struct Product
{
int iPartNumber;
char szName[80];
double dPrice;
};
struct Customer
{
int iID;
char szName[50];
char szAddress[50];
char szCity[20];
char szState[20];
char szZip[9];
};
void main()
{
Date dt = { 7, 11, 1998 };
Product prod = {122, "XXX", 19.95};
Customer cust = {15, "John Daniels", "304 Oak Street","Boring", "Oregon", "97205"};
IStorage * pRootStorage;
IStream * pOrderInfo;
CoInitialize(NULL);
StgCreateDocfile(L"data.dat", STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0, &pRootStorage);
pRootStorage->CreateStream(L"Order Info", STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pOrderInfo);
pOrderInfo->Write(&dt, sizeof(dt), NULL);
pOrderInfo->Write(&prod, sizeof(prod), NULL);
pOrderInfo->Write(&cust, sizeof(cust), NULL);
pOrderInfo->Release();
pRootStorage->Release();
CoUninitialize();
}
Could you give me a link or a clue to a good tutorial on WRITING and READING
OLE Structured Storage files? (Please, don't tell me that there is a MSDN, 'cause it
doesn't help me too much, it's dizzy, it has many links and I usually loose the right path
among them)