Click here to Skip to main content
15,897,704 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: #region [VS2005 IDE] Pin
Waldermort6-Feb-07 23:23
Waldermort6-Feb-07 23:23 
GeneralRe: #region [VS2005 IDE] Pin
Eytukan6-Feb-07 23:39
Eytukan6-Feb-07 23:39 
AnswerRe: #region [VS2005 IDE] Pin
krmed7-Feb-07 2:19
krmed7-Feb-07 2:19 
GeneralRe: #region [VS2005 IDE] Pin
Eytukan7-Feb-07 3:24
Eytukan7-Feb-07 3:24 
Questionconvert WCHAR to int Pin
amitmistry_petlad 6-Feb-07 22:08
amitmistry_petlad 6-Feb-07 22:08 
AnswerRe: convert WCHAR to int Pin
Waldermort6-Feb-07 22:39
Waldermort6-Feb-07 22:39 
AnswerRe: convert WCHAR to int Pin
Michael Dunn6-Feb-07 22:43
sitebuilderMichael Dunn6-Feb-07 22:43 
AnswerRe: convert WCHAR to int Pin
James R. Twine7-Feb-07 2:02
James R. Twine7-Feb-07 2:02 
amitmistry_petlad wrote:
WCHAR w_Year[260];
GetDlgItemText(hDlg,IDC_EDIT_YEAR,w_Year,MAX_PATH);
<code>char * Year=" ";
sprintf(Year,"%s",w_Year);</code>
int int_Year=atoi(Year);
is there any other way to get int value;


   That is part of your problem - even though you are creating a non-const pointer Year, you are assigning it to a constant string, not a real writable buffer, so the code will crash in sprintf(...) when it tries to copy into the memory pointed to by Year.  (BTW - %s and %S can be used to format ANSI or Unicode strings in either kind of build; the uppercase %S version formats the opposite type, so in an ANSI build, %S formats a wide string into a narrow buffer, and in a Unicode build it does the opposite.)

   The other solutions you have received will get you the integer value of the string obtained from IDC_EDIT_YEAR, but you still should know that what you have tried to do is dangerous.

   Peace!

-=- James
Please rate this message - let me know if I helped or not!<HR>If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles

Questionreading problem Pin
vlad.gs6-Feb-07 21:47
vlad.gs6-Feb-07 21:47 
GeneralRe: reading problem Pin
prasad_som6-Feb-07 23:26
prasad_som6-Feb-07 23:26 
QuestionWindows service Pin
david bagaturia6-Feb-07 21:26
david bagaturia6-Feb-07 21:26 
AnswerRe: Windows service Pin
Mark Salsbery7-Feb-07 8:00
Mark Salsbery7-Feb-07 8:00 
AnswerRe: Windows service Pin
Mark Salsbery7-Feb-07 8:03
Mark Salsbery7-Feb-07 8:03 
GeneralRe: Windows service Pin
david bagaturia7-Feb-07 18:13
david bagaturia7-Feb-07 18:13 
QuestionDisplay 2D array Pin
Aint6-Feb-07 21:04
Aint6-Feb-07 21:04 
AnswerRe: Display 2D array Pin
_AnsHUMAN_ 6-Feb-07 21:07
_AnsHUMAN_ 6-Feb-07 21:07 
AnswerRe: Display 2D array Pin
Cedric Moonen6-Feb-07 21:42
Cedric Moonen6-Feb-07 21:42 
QuestionComplier Errors built when first time and not for the second time Pin
venkat_5576-Feb-07 20:08
venkat_5576-Feb-07 20:08 
AnswerRe: Complier Errors built when first time and not for the second time Pin
Don Box6-Feb-07 20:26
Don Box6-Feb-07 20:26 
GeneralRe: Complier Errors built when first time and not for the second time Pin
venkat_5576-Feb-07 22:18
venkat_5576-Feb-07 22:18 
GeneralRe: Complier Errors built when first time and not for the second time Pin
Waldermort6-Feb-07 22:35
Waldermort6-Feb-07 22:35 
GeneralRe: Complier Errors built when first time and not for the second time Pin
venkat_5577-Feb-07 0:06
venkat_5577-Feb-07 0:06 
GeneralRe: Complier Errors built when first time and not for the second time Pin
jhwurmbach7-Feb-07 1:17
jhwurmbach7-Feb-07 1:17 
Questioncustom class like CButton Pin
kirrik6-Feb-07 20:06
kirrik6-Feb-07 20:06 
AnswerRe: custom class like CButton Pin
Don Box6-Feb-07 20:22
Don Box6-Feb-07 20:22 

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.