Click here to Skip to main content
15,902,874 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: hiding the taskbar icons using win32 [modified] Pin
Nibu babu thomas31-Mar-08 21:34
Nibu babu thomas31-Mar-08 21:34 
QuestionPossible to load swf in resource? Pin
manish.patel31-Mar-08 19:32
manish.patel31-Mar-08 19:32 
GeneralRe: Possible to load swf in resource? Pin
Mark Salsbery1-Apr-08 6:55
Mark Salsbery1-Apr-08 6:55 
GeneralRe: Possible to load swf in resource? Pin
manish.patel1-Apr-08 18:17
manish.patel1-Apr-08 18:17 
GeneralRe: Possible to load swf in resource? Pin
Mark Salsbery1-Apr-08 19:00
Mark Salsbery1-Apr-08 19:00 
GeneralDisabling Standard buttons in propertysheet Pin
Gita.Bairavi31-Mar-08 18:57
Gita.Bairavi31-Mar-08 18:57 
QuestionHow to cal a PropertySheet inside a PropertySheet Pin
Gita.Bairavi31-Mar-08 18:13
Gita.Bairavi31-Mar-08 18:13 
GeneralBetter error checking using sscanf Pin
acerunner31631-Mar-08 16:09
acerunner31631-Mar-08 16:09 
So I am trying to take user input from an editbox for my dialog based app. The value should be a single float. I retrieve the value using GetWindowText() and sscanf(). I check that sscanf returns 1 to show that it in fact succesfully scanned in one

CString ValueStr;<br />
float ValueFloat;<br />
<br />
GetDlgItem(IDC_EDITBOX)->GetWindowText(ValueStr);<br />
if (1 == sscanf(ValueStr, "%f", ValueFloat))<br />
{<br />
//valid data, processing it...<br />
}<br />
else<br />
{<br />
MessageBox("Invalid input value.");<br />
}


The problem is that this method of error checking is not the best. For example, if the user enters "20.5p", that will not flag an error, but instead will just take 20.5 as a valid value and ignore "p". How can I do more thorough error checking, such that I check to make sure the input is ONLY a single float and no trailing characters?

Thanks
GeneralRe: Better error checking using sscanf Pin
Saurabh.Garg31-Mar-08 16:35
Saurabh.Garg31-Mar-08 16:35 
GeneralRe: Better error checking using sscanf Pin
Saurabh.Garg31-Mar-08 17:56
Saurabh.Garg31-Mar-08 17:56 
QuestionRe: Better error checking using sscanf Pin
David Crow31-Mar-08 16:37
David Crow31-Mar-08 16:37 
GeneralRe: Better error checking using sscanf Pin
acerunner31631-Mar-08 17:11
acerunner31631-Mar-08 17:11 
GeneralRe: Better error checking using sscanf Pin
David Crow1-Apr-08 3:17
David Crow1-Apr-08 3:17 
GeneralRe: Better error checking using sscanf Pin
fefe.wyx31-Mar-08 16:41
fefe.wyx31-Mar-08 16:41 
GeneralRe: Better error checking using sscanf Pin
David Crow31-Mar-08 16:49
David Crow31-Mar-08 16:49 
GeneralRe: Better error checking using sscanf Pin
acerunner31631-Mar-08 17:14
acerunner31631-Mar-08 17:14 
GeneralRe: Better error checking using sscanf Pin
Naveen31-Mar-08 18:13
Naveen31-Mar-08 18:13 
GeneralRe: Better error checking using sscanf Pin
Iain Clarke, Warrior Programmer1-Apr-08 0:45
Iain Clarke, Warrior Programmer1-Apr-08 0:45 
QuestionTurn on\off a LED connected to USB port Pin
Joseph Marzbani31-Mar-08 8:39
Joseph Marzbani31-Mar-08 8:39 
GeneralRe: Turn on\off a LED connected to USB port Pin
led mike31-Mar-08 8:42
led mike31-Mar-08 8:42 
GeneralRe: Turn on\off a LED connected to USB port Pin
CPallini31-Mar-08 10:18
mveCPallini31-Mar-08 10:18 
QuestionRe: Turn on\off a LED connected to USB port Pin
Maximilien31-Mar-08 15:59
Maximilien31-Mar-08 15:59 
GeneralRe: Turn on\off a LED connected to USB port Pin
CPallini31-Mar-08 21:31
mveCPallini31-Mar-08 21:31 
GeneralRe: Turn on\off a LED connected to USB port Pin
Cedric Moonen31-Mar-08 20:28
Cedric Moonen31-Mar-08 20:28 
QuestionRe: Turn on\off a LED connected to USB port Pin
CPallini31-Mar-08 21:54
mveCPallini31-Mar-08 21:54 

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.