Re: Have read the documentation, and am confused
From: Relvinian (smpres_at_hotmail.com)
Date: 12/08/04
- Next message: Kim Gräsman: "Re: using midl"
- Previous message: Bonj: "Re: BSTR"
- In reply to: Bonj: "Have read the documentation, and am confused"
- Next in thread: Igor Tandetnik: "Re: Have read the documentation, and am confused"
- Reply: Igor Tandetnik: "Re: Have read the documentation, and am confused"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 08 Dec 2004 01:21:41 -0700
Bonj wrote:
> Hi
> The third and fifth parameters for wcstombs_s are listed as
>
> [in]sizeInBytes
> Buffer size for mbstr.
> [in] count
> The maximum number of bytes that can be stored in the multibyte output
> string.
> What is the difference between the two? Surely the "buffer size" is *defined
> as* "the maximum number of bytes that can be stored" in it? Would the two
> ever be different?
>
>
>
Since I don't have the beta of 2005 and can't really say, I'm taking a
stab at it. I would say that the documentation is "not correct" and
should read something like this for the 5th parameter:
"The maximum number of characters that can be stored in the multibyte
output string".
If you go with that assumption, the buffer length and number of
characters are different values. For example:
#define MAX_CHARACTERS 100
w_char* buffer = new w_char[100];
; do something with buffer
delete[] buffer;
Here, the actual size of 'buffer' is 200 because w_char is a multibyte
character. But the number of characters you can put into this buffer is
only 100 without going out-of-bounds.
Relvinian
- Next message: Kim Gräsman: "Re: using midl"
- Previous message: Bonj: "Re: BSTR"
- In reply to: Bonj: "Have read the documentation, and am confused"
- Next in thread: Igor Tandetnik: "Re: Have read the documentation, and am confused"
- Reply: Igor Tandetnik: "Re: Have read the documentation, and am confused"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|