Re: Conversion functions.

2007-09-11 Thread Allin Cottrell
On Fri, 7 Sep 2007, Magnus Myrefors wrote: > By the way I have found out that I used a way of reading lines > from the input-file which can cause some problem. I read in a > book that fgets(string, sizeof(string), input) should read one > line up to sizeof(string) -1 or to the first newline- ch

Re: Conversion functions.

2007-09-08 Thread Yeti
On Fri, Sep 07, 2007 at 05:02:37PM +0200, Magnus Myrefors wrote: > By the way I have found out that I used > a way of reading lines from the input-file which can cause > some problem. I read in a book that fgets(string, sizeof(string), input) > should read one line up to sizeof(string) -1 or to th

Re: Conversion functions.

2007-09-07 Thread Magnus Myrefors
On Fri, 7 Sep 2007 16:16:35 +0200 Magnus Myrefors <[EMAIL PROTECTED]> wrote: By the way I have found out that I used a way of reading lines from the input-file which can cause some problem. I read in a book that fgets(string, sizeof(string), input) should read one line up to sizeof(string) -1 or t

Re: Conversion functions.

2007-09-07 Thread Magnus Myrefors
I looked at the code and I as far as I also think that something should be printed to stdout. The only thing I could see in the code was that malloc wasn't used to allocate char *buf in the args to function getline(). Magnus On Fri, 7 Sep 2007 10:08:19 +0200 David Nečas (Yeti) <[EMAIL PROTECTE

Re: Conversion functions.

2007-09-07 Thread Yeti
On Fri, Sep 07, 2007 at 01:45:09AM +0200, Magnus Myrefors wrote: > > yeti>> I have tested your minimal testprogram with the whole > test-file. Unfortunately the program doesn't print anything to > stdout. It doesn't seem to be any data stored in the GSList > or in the datastructure, Data *data. I

Re: Conversion functions.

2007-09-06 Thread Matí­as Alejandro Torres
Jaja, so it wasn't crappy, it was **crap*.* :P ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Conversion functions.

2007-09-06 Thread Magnus Myrefors
yeti>> I have tested your minimal testprogram with the whole test-file. Unfortunately the program doesn't print anything to stdout. It doesn't seem to be any data stored in the GSList or in the datastructure, Data *data. (I tried to print a field every time a new line was about to be read in the w

Re: Conversion functions.

2007-09-06 Thread Yeti
On Thu, Sep 06, 2007 at 11:00:11AM -0300, Matí­as Alejandro Torres wrote: > Here's the minimal program to read that. The reading part is kind of > crappy but it works with that example. The trouble with the reading part is not that it's kind of crappy (well, it is IMO, reading by character makes

Re: Conversion functions.

2007-09-06 Thread Matí­as Alejandro Torres
Magnus Myrefors escribió: > Hi, > Ok, here's a small part of it. The whole file is about > 2400 rows. I can read over approximately 95 % of it ok > but the rest is somewhat corrupted. I think it is > the function g_ascii_isdigit() that fails sometimes which > leaves a uncompleted conversion. I a

Re: Conversion functions.

2007-09-05 Thread Allin Cottrell
On Tue, 4 Sep 2007, Magnus Myrefors wrote: > I tested my code with valgrind and I got some error-messages > that derived from my own code.I changed the code and then > the error-messages disapperad. I still get wrong values that > seem to occur randomly though... As Yeti said, you should try wr

Re: Conversion functions.

2007-09-05 Thread Matí­as Alejandro Torres
What's the input file like? Can you attach a part of it? If you do so, I can make a try on reading it. Matías ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Conversion functions.

2007-09-05 Thread Magnus Myrefors
I managed to compile g_ascii_strtod() in my own code. I obtain the same result though. I use another function that I want to look how it is coded and it is the function g_ascii_isdigit(). I have searced for it in glib-2.12-9 but I didn't find it... /Magnus On Wed, 5 Sep 2007 00:47:36 +0200 David

Re: Conversion functions.

2007-09-04 Thread Yeti
On Tue, Sep 04, 2007 at 11:55:58PM +0200, Magnus Myrefors wrote: > > I tried with strtod() but it only worked with strings with no > decimal-point, otherwise the resulting double was truncated. > ... > > - if the numbers are normal, i.e. supported by underlying > > strtod(), try to use it direct

Re: Conversion functions.

2007-09-04 Thread Magnus Myrefors
I tried with strtod() but it only worked with strings with no decimal-point, otherwise the resulting double was truncated. I also tried to copy g_ascii_strtod() (from glib-2.12-9) into my code but it didn't compile and I didn't quite understand the if-statement if(decimal_point_pos) {} where deci

Re: Conversion functions.

2007-09-04 Thread Yeti
On Tue, Sep 04, 2007 at 04:18:23PM +0200, Magnus Myrefors wrote: > > I tested my code with valgrind and I got some error-messages > that derived from my own code.I changed the code and then > the error-messages disapperad. I still get wrong values that > seem to occur randomly though... > Belo

Re: Conversion functions.

2007-09-04 Thread Magnus Myrefors
I tested my code with valgrind and I got some error-messages that derived from my own code.I changed the code and then the error-messages disapperad. I still get wrong values that seem to occur randomly though... Below is the output from valgrind. It is the end of the error-messages that were

Re: Conversion functions.

2007-09-04 Thread Yeti
On Tue, Sep 04, 2007 at 01:12:11AM +0200, Magnus Myrefors wrote: > > when I start the test I am in the same state > and I use the same text-file evey time. > The converted values can be different > or the same between different test-runs so > the wrong values seem to occur randomly. Then try val

Re: Conversion functions.

2007-09-03 Thread Magnus Myrefors
when I start the test I am in the same state and I use the same text-file evey time. The converted values can be different or the same between different test-runs so the wrong values seem to occur randomly. Magnus On Tue, 4 Sep 2007 00:26:28 +0200 David Nečas (Yeti) <[EMAIL PROTECTED]> wrote: >

Re: Conversion functions.

2007-09-03 Thread Yeti
On Mon, Sep 03, 2007 at 08:46:51PM +0200, Magnus Myrefors wrote: > I am currently trying to use the glib-functions g_ascii_strtod(x,y) > and g_ascii_strtoll(x,y) to convert values from a text-file. > It works fine most of the time but occasionally the converted values > are absolutely wrong

Conversion functions.

2007-09-03 Thread Magnus Myrefors
Hi, I am currently trying to use the glib-functions g_ascii_strtod(x,y) and g_ascii_strtoll(x,y) to convert values from a text-file. It works fine most of the time but occasionally the converted values are absolutely wrong or just a bit wrong. I am using the glib libraries (libglib2.0-dev