Re: [Vala] Convert string to int



On Fri, Sep 03, 2010 at 12:12:19AM +0300, Chriss Kalogeropoulos wrote:
Hi all,

i just started to play with vala and i find it very interesting and
promising project.

How can i validate that the string conversion to int has actually
happened ? It does not throw any exceptions and it seems to use atoi
which returns 0 on failure, which does not say much.

Generally if a method fails how does it handle it ? It throws exceptions
or uses some global error code ? I read in a previous post that vala
only handles glib and friends errors but not normal c library errors
although they are used all over.

You can use to_long and do a check on the endptr.

-- 
http://www.debian.org - The Universal Operating System

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]