View the Most Wanted LQ Wiki articles.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-04-2003, 10:45 AM   #1
Registered: Jul 2003
Location: Santiago de Chile
Distribution: Debian testing/unstable
Posts: 74

Rep: Reputation: 15
Reading integers in a GTK textbox...


i have problems to validate the data that i read in a GTK textbox...

i was using the g_strtod() function to convert from human entered strings to decimals but when you enter a word that function returns a zero.... i dont know how to validate... becuase, zero is a valid value.

if you enter numbers with alphabetic chars it cuts up and returns the numbers only...i.e.:

input: 123sg, output 123

any idea on how to convert in a good way the data entered????

Thank you.

Old 11-04-2003, 05:22 PM   #2
Registered: Oct 2003
Location: Long Island, N.Y., U.S.A
Distribution: Gentoo, Slackware
Posts: 79

Rep: Reputation: 15

if the nptr == endptr then you know that nothing was converted, so a word will still return 0, but having nptr==endptr will mean that the value is not zero.
Old 11-04-2003, 09:44 PM   #3
Registered: Jul 2003
Location: Santiago de Chile
Distribution: Debian testing/unstable
Posts: 74

Original Poster
Rep: Reputation: 15
Thank you man!!!!!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
wxPython textbox command line help arpanet1969 Programming 5 09-13-2005 06:38 PM
64-bit integers in C nodger Programming 1 03-31-2005 09:06 AM
Reading negative integers from a file? (C++, iostream library) -=zAe=- Programming 5 02-21-2005 01:59 PM
Background for posting textbox white? vharishankar LQ Suggestions & Feedback 2 11-11-2004 07:09 PM
converting integers to strings 1337 Twinkie Programming 12 08-06-2004 05:57 PM

All times are GMT -5. The time now is 12:34 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration