|
-
May 18th, 1999, 09:36 PM
#1
IStorage,IStream
dear gurus,
i have been using the IStorage , IStream objects but have encountered exceptions.
i shall give a brief overview of my code
IStorage* pStorage;
HRESULT hr;
hr=StgCreateDocfile(
L"test2.stg",STGM_DIRECT|STGM_WRITE|STGM_SHARE_EXCLUSIVE|STGM_CREATE,NULL,&pStorage);
ULONG cbytes_written=0;
char pt[3]="hi";
IStream* pStream;
pStorage->CreateStream(L"layer1",
STGM_DIRECT | STGM_WRITE|STGM_CREATE ,0,0,&pStream);
pStream->Write(pt,strlen(pt),&cbytes_written);//i get an exception here
i get an exception in the last statement . can anyone tell me why? and how should i go about it?
also, here variable pt is a character , so the 2nd arguement in the Write function is strlen(pt), what if it was integer?
early help appreciated
-
May 28th, 1999, 01:05 PM
#2
Re: IStorage,IStream
Hi.
You didn't check the return from CreateStream(...). You _must_ specify STGM_SHARE_EXCLUSIVE. Or that into your flag word and I'm pretty confident your code will work properly.
Regards,
Peter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|