Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IStorage problem - read this, please!

Status
Not open for further replies.

Robertus

Programmer
Feb 16, 2001
81
RO
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, &quot;XXX&quot;, 19.95};
Customer cust = {15, &quot;John Daniels&quot;, &quot;304 Oak Street&quot;,&quot;Boring&quot;, &quot;Oregon&quot;, &quot;97205&quot;};

IStorage * pRootStorage;
IStream * pOrderInfo;

CoInitialize(NULL);

StgCreateDocfile(L&quot;data.dat&quot;, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0, &pRootStorage);

pRootStorage->CreateStream(L&quot;Order Info&quot;, 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)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top