Click here to Skip to main content
15,926,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: cin >> foo; Sometimes it doesn't take... Pin
LunaticFringe30-Oct-09 19:47
LunaticFringe30-Oct-09 19:47 
GeneralRe: cin >> foo; Sometimes it doesn't take... Pin
CaptainSeeSharp30-Oct-09 19:50
CaptainSeeSharp30-Oct-09 19:50 
GeneralRe: cin >> foo; Sometimes it doesn't take... Pin
LunaticFringe30-Oct-09 19:55
LunaticFringe30-Oct-09 19:55 
GeneralRe: cin >> foo; Sometimes it doesn't take... Pin
CaptainSeeSharp30-Oct-09 20:02
CaptainSeeSharp30-Oct-09 20:02 
GeneralRe: cin >> foo; Sometimes it doesn't take... Pin
LunaticFringe30-Oct-09 20:14
LunaticFringe30-Oct-09 20:14 
GeneralRe: cin >> foo; Sometimes it doesn't take... Pin
Randor 30-Oct-09 22:31
professional Randor 30-Oct-09 22:31 
QuestionLPCSTR and char* issues Pin
MbHimself30-Oct-09 17:34
MbHimself30-Oct-09 17:34 
AnswerRe: LPCSTR and char* issues [modified] Pin
LunaticFringe30-Oct-09 18:46
LunaticFringe30-Oct-09 18:46 
From Format Specification Fields: scanf and wscanf Functions[^] :

An input field is defined as all characters up to the first white-space character (space, tab, or newline), or up to the first character that cannot be converted according to the format specification, or until the field width (if specified) is reached. If there are too many arguments for the given specifications, the extra arguments are evaluated but ignored.

Setting a breakpoint on the MessageBox call would allow you to examine the contents of MyString before it's displayed, where you can see it's already truncated.

A couple additional points. My C is a little rusty, but ..

a) Your 'LPCSTR(MyString)' cast is unnecessary.
b) It's not a cast, but rather (I believe) an invocation of a LPCSTR constructor with MyString as a parameter. You're not executing a cast, you're creating a new null-terminated string pointer, pointed at MyString.
c) A cast would have been '(LPCSTR)MyString'. But like I said, it isn't required here.

modified on Saturday, October 31, 2009 12:52 AM

GeneralRe: LPCSTR and char* issues Pin
MbHimself30-Oct-09 19:09
MbHimself30-Oct-09 19:09 
GeneralRe: LPCSTR and char* issues Pin
LunaticFringe30-Oct-09 19:42
LunaticFringe30-Oct-09 19:42 
AnswerRe: LPCSTR and char* issues Pin
«_Superman_»30-Oct-09 19:40
professional«_Superman_»30-Oct-09 19:40 
Questionhow to use a matrix associeted to control variables ? Pin
timbk30-Oct-09 13:32
timbk30-Oct-09 13:32 
AnswerRe: how to use a matrix associeted to control variables ? Pin
«_Superman_»30-Oct-09 15:55
professional«_Superman_»30-Oct-09 15:55 
Questiondll linking Pin
rahul116730-Oct-09 6:31
rahul116730-Oct-09 6:31 
AnswerRe: dll linking Pin
Richard MacCutchan30-Oct-09 6:55
mveRichard MacCutchan30-Oct-09 6:55 
QuestionRe: dll linking Pin
David Crow30-Oct-09 7:42
David Crow30-Oct-09 7:42 
AnswerRe: dll linking Pin
rahul116730-Oct-09 20:26
rahul116730-Oct-09 20:26 
GeneralRe: dll linking Pin
Cedric Moonen30-Oct-09 23:25
Cedric Moonen30-Oct-09 23:25 
GeneralRe: dll linking Pin
David Crow2-Nov-09 3:35
David Crow2-Nov-09 3:35 
QuestionProblem while using CComBSTR Pin
Rahul Vaishnav30-Oct-09 5:37
Rahul Vaishnav30-Oct-09 5:37 
AnswerRe: Problem while using CComBSTR Pin
Rahul Vaishnav30-Oct-09 17:57
Rahul Vaishnav30-Oct-09 17:57 
QuestionJET / ADO - Windows 7 Pin
Robert Valentino30-Oct-09 4:55
Robert Valentino30-Oct-09 4:55 
QuestionBreadth First Search Algorithm in C Pin
mossy46430-Oct-09 4:50
mossy46430-Oct-09 4:50 
AnswerRe: Breadth First Search Algorithm in C Pin
Member 419459330-Oct-09 7:37
Member 419459330-Oct-09 7:37 
AnswerRe: Breadth First Search Algorithm in C Pin
BobInNJ30-Oct-09 10:47
BobInNJ30-Oct-09 10:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.