I have tested this (with GiD 10.1.6d win x32) and it worked well.
I think that probably the question Climate_Pattern_(NPATT):#CB#(Sinusoidal_Climate_Change,Constant_Climate_Change) is not the 10th question of your PROBLEM DATA block !!
note that questions are numbered from 1 to n, and is not the line number, is the question counter
to debug it you can also print the value of *Gendata(10)
GENDATA(10)=*Gendata(10)
*If(strcmp(Gendata(10),“Sinusoidal_Climate_Change”)==0)
1 *
*elseif(strcmp(Gendata(10),“Constant_Climate_Change”)==0)
0 *
*endif
To avoid index mistakes, and have a more easy to maintain (when adding/removing fields in future problemtype versions)
it is recommended to use the field name instead of the index
Gendata(1)=*GenData(Climate_Pattern_(NPATT))
*If(strcmp(Gendata(Climate_Pattern_(NPATT)),“Sinusoidal_Climate_Change”)==0)
1 *
*elseif(strcmp(Gendata(Climate_Pattern_(NPATT)),“Constant_Climate_Change”)==0)
0 *
*endif
Really the internal full name of the question is
"Climate_Pattern_(NPATT):#CB#(Sinusoidal_Climate_Change,Constant_Climate_Change) "
but to avoid so long and difficult names of this special fields is accepted the abbreviation removing from #CB# to the end
Enrique Escolano
----- Original Message -----
From: “Farzam, Arash” farzam at okstate.edu
To: GiDlist at listas.cimne.upc.edu
Sent: Tuesday, June 14, 2011 7:55 AM
Subject: [GiDlist] If (strcmp) statement
Dear All,
I have written part of my .prb file (lines 10 and 11) as below:
QUESTION: Climate_Pattern(NPATT):#CB#(Sinusoidal_Climate_Change,Constant_Climate_Change)_
VALUE: Sinusoidal_Climate_Change
and I have an if statement in my .bas file as
*If(strcmp(Gendata(10),“Sinusoidal_Climate_Change”)==0)
_1 *_
*elseif(strcmp(Gendata(10),“Constant_Climate_Change”)==0)
_0 *_
*endif
But I don’t get a value of 0 or 1 in the results file (whether I choose the first or second option).
Do you have an idea of what I am doing wrong?
Best Regards,
Arash Farzam
GiDlist mailing list
GiDlist at listas.cimne.upc.edu
_http://listas.cimne.upc.edu/cgi-bin/mailman/listinfo/gidlist_
-------------- next part --------------
An HTML attachment was scrubbed…
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20110614/a506988c/attachment.htm