Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 21st, 2007, 08:32 PM
Registered User
 
Join Date: Feb 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Bourne
Default Determining Data type with CIN

Thanks for taking the time to read this, and any replies are much appriciated.

I am looking for a way to determine the type of data that the user has inputed into my program. For example: When I ask the user to input an integer, and they enter a letter or a word, the program loops, and ultimately crashes. I would like to prevent this, by checking the value and either accepting or rejecting it (if this is even how this works) before the program.. tries to use it? and crashes.

Thanks for any reply.

Reply With Quote
  #2 (permalink)  
Old March 23rd, 2007, 09:00 AM
Authorized User
 
Join Date: Mar 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://home.att.net/~jackklein/c/code/strtol.html

Reply With Quote
  #3 (permalink)  
Old March 23rd, 2007, 05:40 PM
Registered User
 
Join Date: Feb 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Bourne
Default

Thanks
:)

I've been looking for this for some time... kind of surprised I didn't find this. Or something like it.

Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Determining data type from Excel gbuller VB How-To 1 September 1st, 2004 08:57 AM
Determining DirectoryItem Type [email protected] VB.NET 0 June 3rd, 2004 05:30 PM
cin.getline alfrepa Visual C++ 0 April 14th, 2004 08:05 PM
Data Type error but it is the correct type Mitch SQL Server 2000 2 March 19th, 2004 11:31 AM
cin and unlimited data set size phenix151 C++ Programming 4 October 13th, 2003 09:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.