Karl Blessing
Programmer
I have here the following function, I've commented out any part pertaining to SafeArray, because I needed to test the list. in any case The main prob starts at the Create command for the safe array, it returns a null, and i'm trying to create a SafeArray that holds an Array of Binary datatypes<br><br>void FileStorage::writeto(LPCSTR name,int fileType)<br>{<br> if(FHead != NULL) <br> {<br> /*long count= 0;<br> SAFEARRAYBOUND rgsabound;<br> rgsabound.lLbound = 0;<br> rgsabound.cElements = bytes;<br> <br> SAFEARRAY FAR* some = SafeArrayCreate(VT_ARRAY ¦ VT_UI1,1,&rgsabound);<br> */<br> ofstream fptr;<br> fptr.open(name, ios:ut ¦ ios::binary);<br> if((fptr != NULL) /*&& (some != NULL)*/)<br> {<br> FCurrent = FHead;<br> do<br> {<br> for(int j = 0; j<= FCurrent->count-1; j++) <br> {<br> fptr.put(FCurrent->AByte[j]);<br> //SafeArrayPutElement(some,&count,(void *)FCurrent->AByte[j]);<br> //count++;<br> }<br> //fptr.write(NewFile, sizeof(NewFile));<br> FCurrent = FCurrent->next;<br> }while(FCurrent != NULL);<br> <br> }<br> fptr.close();<br> //////////////////check SafeArray///////////////<br> /*if ( some != NULL )<br> {<br> VARIANT FAR* Buffer;<br> Buffer = (VARIANT*) some;<br> long Dim = SafeArrayGetDim(Buffer->parray);<br> long UpperBounds, LowerBounds;<br> if(Dim == 1) <br> {<br> SafeArrayGetLBound(Buffer->parray, 1, &LowerBounds);<br> SafeArrayGetUBound(Buffer->parray, 2, &UpperBounds);<br> <br> unsigned char* buff;<br> CString m_abBinaryData= "";<br> SafeArrayAccessData(Buffer->parray, (void**)&buff);<br> for ( int i = 0; i < bytes; i++)<br> {<br> m_abBinaryData += buff<i>;<br> buff<i> = 0;<br> }<br> SafeArrayUnaccessData(Buffer->parray);<br> }<br> }*/<br><br> }<br>}<br><br>any sugestions? <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)