LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

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


Hi...

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, 04:22 PM   #2
xexix
Member
 
Registered: Oct 2003
Location: Long Island, N.Y., U.S.A
Distribution: Gentoo, Slackware
Posts: 79

Rep: Reputation: 15
http://developer.gnome.org/doc/API/g....html#G-STRTOD

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, 08:44 PM   #3
Claus
Member
 
Registered: Jul 2003
Location: Santiago de Chile
Distribution: Debian testing/unstable
Posts: 74

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


Reply


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 05:38 PM
64-bit integers in C nodger Programming 1 03-31-2005 08:06 AM
Reading negative integers from a file? (C++, iostream library) -=zAe=- Programming 5 02-21-2005 12:59 PM
Background for posting textbox white? vharishankar LQ Suggestions & Feedback 2 11-11-2004 06:09 PM
converting integers to strings 1337 Twinkie Programming 12 08-06-2004 04:57 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:26 AM.

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