problem with gnome_init



Hello,

I beggining to write a gnome software, but I have a strange problem.

I am doing exactly the same process before and after the gnome_init
function and I don't obtain the same result.

It seems that the problem is coming from sscanf. The sscanf just parses
a line and doesn't return the same things.

I attached to this email a small source which show this problem.

Have you got an idea about this issue ?

-- 
Eric Laeuffer
laeuffer cybercable fr
#include <gnome.h>
#include <stdio.h>

int main(int argc,char **argv) 
{

  char *line;
  char  date[20];
  float open;
  float high;
  float low;
  float close;
  int   vol;
  int   nb;

  char *line2;
  char  date2[20];
  float open2;
  float high2;
  float low2;
  float close2;
  int   vol2;
  int   nb2;


  line = strdup("000801   94.500   95.562   92.500   93.688 94900\n");      
  printf("line : %s\n", line);
  nb = sscanf(line, "%s %f %f %f %f %d", date, &open, &high, &low, &close ,&vol);

  printf("nb : %d\n", nb);

  printf("%s %7.3f %7.3f %7.3f %7.3f %d\n", 
	 date,
	 open,
	 high,
	 low,
	 close,
	 vol);
  

  printf("\n GNOME_INIT\n");

  gnome_init("canvas-example", "0.0", argc, argv);  

  line2 = strdup("000801   94.500   95.562   92.500   93.688 94900\n");      

  printf("line : %s\n", line2);

  nb2 = sscanf(line2, "%s %f %f %f %f %d", date2, &open2, &high2, &low2, &close2 ,&vol2);

  printf("nb : %d\n", nb2);

  printf("%s %7.3f %7.3f %7.3f %7.3f %d\n", 
	 date2,
	 open2,
	 high2,
	 low2,
	 close2,
	 vol2);
    

}


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