Re: GetDataToBuffer/GetDataToBufferAt - WeOnlyDo Discussion board

Re: GetDataToBuffer/GetDataToBufferAt (General questions)

by Lyle, Wednesday, November 23, 2005, 20:09 (6733 days ago) @ wodSupport

I am hoping that you would return the number of bytes actually written to the buffer during that method call, just as you already do for each of your buffered property retrieval commands (e.g., GetListItem, GetErrorText, etc.).

I have developed a workaround for using the GetDataToBufferAt method to retrieve an ASCII file, but it's pretty ugly. I use a freshly zeroed buffer for each successive call to the method -- when the size of the string returned is less than the buffer size, I know that I have reached the end of the file.

However, this will not work for BINARY files since 0x00 is a valid byte value in binary files.

I cannot access the DLL asynchronously from my application, so I am unable to use the GetAttributes method to invoke the Attributes callback in order to obtain the file size. If I could get the file size, I would be able to to use that as my boundary condition when calling GetDataToBufferAt.

The algorithm would be very straight forward if the bufferSize parameter for the GetDataToBuffer and GetDataToBufferAt methods was an int pointer -- the programmer would send in the buffer size and the DLL would return the actual number of bytes written into the buffer (like with GetErrorText, etc.).

Instead of going through the hassle of changing the existing interface, perhaps you could create a new version of those two methods that would use the int pointer?


Complete thread: