Re: cgets bug?
- From: "David F." <df2705@xxxxxxxxxxxxxxxx>
- Date: Mon, 19 Mar 2007 13:11:01 -0700
Hey Charles .. Turns out the workaround causes a problem ... in cwtomb.c,
line 93:
_VALIDATE_RETURN_ERRCODE(sizeInBytes >0, ERANGE);
Fails because SizeInBytes is zero (it happens when calling _cgetts_s with a
length of two (enter Y) then on the next cgets of the normal size it bombs
out on the reading of the single char).
"Charles Wang[MSFT]" <changliw@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:IvX5cAKYHHA.1352@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi, David,
Thanks for your response.
The issue had been in our internal bug list, so I said that it was a
confirmed product by design issue. Unfortunately from the internal log,
there was no plan for fixing this issue now. That is why I recommend that
you use other method. If ANSI is not neccessary in your requirement, you
may use Unicode character set to build you application.
Anyway, I report it again via http://connect.microsoft.com. Please refer
to:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedba
ckID=262098
Also, from my test, I found a workaround to resolve this issue by adding
an
additional line of _cgetts_s after the first _cgetts_s function when your
application is build with NON-UNICODE character set. Please refer to:
TCHAR b[128];
b[(sizeof(b)/sizeof(b[0]))-1]=0;
size_t br;
int i=0;
do {
_tprintf(_T("Enter Something>"));
#ifdef _UNICODE
_cgetts_s(b, sizeof(b)/sizeof(b[0]), &br);
#else
TCHAR chrend[1];
_cgetts_s(b, sizeof(b)/sizeof(b[0]), &br);
_cgetts_s(chrend, sizeof(chrend)/sizeof(chrend[0]), &br);
#endif
} while (br==0);
For your question, "I tried flush the buffer via checking for kbhit() but
it doesn't show up ..
must be buffered somewhere else? ", I think that the _cgetts_s input
buffer
may be different from standard input buffer and kbhit() or other flushing
buffer functions could not clear it. Unfortunately this is undocumented.
Hope this helps. If you have any other questions or concerns, please feel
free to let me know.
Have a good day!
Charles Wang
Microsoft Online Community Support
=====================================================
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications
If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
======================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
======================================================
.
- Follow-Ups:
- Re: cgets bug?
- From: Charles Wang[MSFT]
- Re: cgets bug?
- From: Charles Wang[MSFT]
- Re: cgets bug?
- References:
- cgets bug?
- From: David F.
- RE: cgets bug?
- From: Charles Wang[MSFT]
- Re: cgets bug?
- From: David F.
- Re: cgets bug?
- From: Charles Wang[MSFT]
- cgets bug?
- Prev by Date: multithread dll
- Next by Date: Re: multithread dll
- Previous by thread: Re: cgets bug?
- Next by thread: Re: cgets bug?
- Index(es):
Relevant Pages
|