11 Nov 2012 at 21:10 #1 aaron333 aaron333 Associate Joined 14 Jun 2009 Posts 1,568 At the moment I have the following that reads in a string: edit Is there any way of using that to read in an integer value instead? I'm a bit lost with this at the moment! Last edited: 14 Nov 2012
At the moment I have the following that reads in a string: edit Is there any way of using that to read in an integer value instead? I'm a bit lost with this at the moment!
11 Nov 2012 at 21:14 #2 Randomface74 Randomface74 Permabanned Joined 9 Aug 2009 Posts 12,234 Location UK http://www.aui.ma/personal/~O.Iraqi/csc1401/casting.htm
11 Nov 2012 at 21:39 #3 Lithium UK Lithium UK Associate Joined 30 May 2006 Posts 70 Use atoi to convert a string into an integer. Or use scanf to read formatted data, instead of using fgets. Last edited: 11 Nov 2012
Use atoi to convert a string into an integer. Or use scanf to read formatted data, instead of using fgets.
11 Nov 2012 at 22:10 #4 aaron333 aaron333 Associate OP Joined 14 Jun 2009 Posts 1,568 Edit. Last edited: 14 Nov 2012
11 Nov 2012 at 22:49 #5 RobHu RobHu Associate Joined 29 Jan 2008 Posts 1,005 int stock = atoi(readString("Enter the current stock level for the item: "));
11 Nov 2012 at 22:59 #6 aaron333 aaron333 Associate OP Joined 14 Jun 2009 Posts 1,568 Thank you very much