Click here to Skip to main content
15,915,319 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCommand Invoked by Shortcut not Crashing But by invoking Menu, it is crashing in MFC Pin
002comp7-Jun-13 0:32
002comp7-Jun-13 0:32 
AnswerRe: Command Invoked by Shortcut not Crashing But by invoking Menu, it is crashing in MFC Pin
SoMad7-Jun-13 1:08
professionalSoMad7-Jun-13 1:08 
SuggestionRe: Command Invoked by Shortcut not Crashing But by invoking Menu, it is crashing in MFC Pin
Richard MacCutchan7-Jun-13 1:08
mveRichard MacCutchan7-Jun-13 1:08 
GeneralRe: Command Invoked by Shortcut not Crashing But by invoking Menu, it is crashing in MFC Pin
002comp7-Jun-13 1:18
002comp7-Jun-13 1:18 
GeneralRe: Command Invoked by Shortcut not Crashing But by invoking Menu, it is crashing in MFC Pin
SoMad7-Jun-13 1:28
professionalSoMad7-Jun-13 1:28 
GeneralRe: Command Invoked by Shortcut not Crashing But by invoking Menu, it is crashing in MFC Pin
Richard MacCutchan7-Jun-13 1:30
mveRichard MacCutchan7-Jun-13 1:30 
GeneralRe: Command Invoked by Shortcut not Crashing But by invoking Menu, it is crashing in MFC Pin
002comp7-Jun-13 1:43
002comp7-Jun-13 1:43 
GeneralRe: Command Invoked by Shortcut not Crashing But by invoking Menu, it is crashing in MFC Pin
Richard MacCutchan7-Jun-13 2:36
mveRichard MacCutchan7-Jun-13 2:36 
QuestionBit concatenation in C++ Pin
Manoj73906-Jun-13 22:51
Manoj73906-Jun-13 22:51 
AnswerRe: Bit concatenation in C++ Pin
Freak306-Jun-13 23:17
Freak306-Jun-13 23:17 
GeneralRe: Bit concatenation in C++ Pin
Manoj73906-Jun-13 23:22
Manoj73906-Jun-13 23:22 
GeneralRe: Bit concatenation in C++ Pin
Chris Losinger7-Jun-13 1:44
professionalChris Losinger7-Jun-13 1:44 
AnswerRe: Bit concatenation in C++ Pin
SoMad7-Jun-13 0:00
professionalSoMad7-Jun-13 0:00 
AnswerRe: Bit concatenation in C++ Pin
Richard MacCutchan7-Jun-13 1:07
mveRichard MacCutchan7-Jun-13 1:07 
Questionreading error Pin
mrby1236-Jun-13 12:26
mrby1236-Jun-13 12:26 
AnswerRe: reading error Pin
«_Superman_»6-Jun-13 18:25
professional«_Superman_»6-Jun-13 18:25 
The problem is readying the string with fscanf_s.
If you replace fscanf_s with fscanf, you will notice that it works without errors.
The _s (secure) versions of the C-Runtime requires that the size of the buffer be known and this is validated by the function.
So you need to pass in the size of the string as an argument following the actual string buffer as shown -
fscanf_s(f_ptr_seed_inf,"%lf     %lf     %s\n",&sd_dis[ifl],&time_onset[ifl], ftitle[ifl].GetBuffer(MAX_PATH), MAX_PATH);

Here is an excerpt from the documentation for scanf_s -

Unlike scanf and wscanf, scanf_s and wscanf_s require the buffer size to be specified for all input parameters of type c, C, s, S, or string control sets that are enclosed in []. The buffer size in characters is passed as an additional parameter immediately following the pointer to the buffer or variable. For example, if you are reading a string, the buffer size for that string is passed as follows:

char s[10];

scanf_s("%9s", s, _countof(s)); // buffer size is 10, width specification is 9

«_Superman 
I love work. It gives me something to do between weekends.


Microsoft MVP (Visual C++) (October 2009 - September 2013)

Polymorphism in C

QuestionDetecting memory leaks in BOOST test cases. Pin
Shailesh H5-Jun-13 0:14
Shailesh H5-Jun-13 0:14 
AnswerRe: Detecting memory leaks in BOOST test cases. Pin
JackDingler6-Jun-13 10:23
JackDingler6-Jun-13 10:23 
QuestionC Basic Pin
john56324-Jun-13 23:52
john56324-Jun-13 23:52 
AnswerRe: C Basic Pin
SandipG 5-Jun-13 0:33
SandipG 5-Jun-13 0:33 
AnswerRe: C Basic Pin
_AnsHUMAN_ 5-Jun-13 0:35
_AnsHUMAN_ 5-Jun-13 0:35 
QuestionRe: C Basic Pin
David Crow5-Jun-13 4:01
David Crow5-Jun-13 4:01 
AnswerRe: C Basic Pin
David Crow5-Jun-13 5:48
David Crow5-Jun-13 5:48 
AnswerRe: C Basic Pin
Erudite_Eric5-Jun-13 8:15
Erudite_Eric5-Jun-13 8:15 
GeneralRe: C Basic Pin
CPallini5-Jun-13 9:46
mveCPallini5-Jun-13 9:46 

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.