Monday, January 20, 2003, 5:16:22 PM, you wrote:
> And now that I have things working, I have to question the logic of
> calling things like TBP_GetName() or TBP_GetVersion() twice. Why not
> just call it once, see if the return value is zero, and process it if
> not? i.e., instead of
> if (TBP_GetName(NULL, 0) > 0)
> iRet = TBP_GetName(strDest, iSize);
> else
> DisplaySomeErrorMessageHereAndExit();
> why not just
> if(0 == TBP_GetName(strDest, iSize));
> {
> DisplaySomeErrorMessageHereAndExit();
> }
If you use your method, there is no way to allocate the exact amount
of memory required. The reason its called twice, is the first call is
used to determine how much memory to allocate. This way you don't
have to allocate huge buffers and hope everything fits.
Rob
________________________________________________
Current version is 1.62 | "Using TBDEV" information:
http://www.silverstones.com/thebat/TBUDLInfo.html