Re: XForms: problems with fl_get_choice_text

Bjoern Fuerst (fuerst@kph.uni-mainz.de)
Thu, 06 Nov 1997 10:20:16 +0100 (CET)

To subscribers of the xforms list from Bjoern Fuerst <fuerst@kph.uni-mainz.de> :

On 06-Nov-97 Giorgos Petasis wrote:
>To subscribers of the xforms list from petasis@estia.iit.nrcps.ariadne-t.gr
>(Giorgos Petasis) :
>
>>
>> To subscribers of the xforms list from Bjoern Fuerst
><fuerst@kph.uni-mainz.de> :
>>
>> sscanf((char *)datum(),"%*s %s %d %s %d",monat,&tag,time_string,&jahr);
>
>Are you sure that everything is correct with this sscanf??? The format
>string has more identifiers that the variable pointers you pass to it.
>I thing you should check what you get in those variables (what are tag and
>jahr? I assume they are just simple variables, because you specify an
>address, and not arrays of chars, where you should have placed e.g.
>&tag[0]. But the format assumes that is a string, so if not null, will
>return at least 2 characters)
>Just an assumption :)
>Could you make a simple program, that shows the problem?

Thanks for the idea, but this should be no problem.
To give some identifiers:

sscanf((char *)datum(),"%*s %s %d %s %d",monat,&tag,time_string,&jahr);

int tag;
char monat[6];
int jahr;
char *time_string;

/* (tag=day, monat=month, jahr=year)

datum() returns something like "Thu Nov 6 11:12:34 1997"

and the sscanf should get the things into the different variables

%*s omits the first (Thu)
%s writes "Nov" into monat (=char monat[6])
%d writes 6 into tag
%s writes "11:12:34" into time_string
%d writes 1997 into jahr

Ok, that's it. I think that should work, or did I misinterpret something?

Bjoern
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/