Hi Jerome ,
I am reading the Dao and really looking forward to your finishing it
as soon as possible.
Some questions from the book:
1.how to output Chinese set using printf(),in my pc,it does not work
properly,for example:
class appRun:Application
{
void Main()
{
char* name="道德经";
printf("You have input %s\n",name);
}
}
2.Struct parameter in a function is passed by reference by default,if
want to pass by value,use add struct key word.For example:
struct Book{};
void Read(Book book);//pass by reference
void Read(struct Book book);//pass by value;
Am I right?if yes,then the problem I met is that compile failure with
below message:
structApp.ec:21: error: invalid type argument of '->' (have 'struct
Book')
structApp.ec:22: error: invalid type argument of '->' (have 'struct
Book)
structApp.ec:27: error: incompatible type for argument 1 of 'Read'
3.
1).enum examples in the book
enum Planet{mercury,venus,earth,mars,jupiter,saturn,uranus,neptune};
enum PlanetOrDwartPlanet:Planet{ceres,pluto,eris};
Your comments in the book say that ceres will be 8,and so on.But when
I pint it ,it is 0.
2).Is it possible to add implementation something like
enum.toString() to print the enum variable's rep. content other than
the value in integer.For example:
Planet p=mercury;
printf("%d\n",p)//===>output is 0;
printf(%s\n",p.toString())===>output is :mercury.
My guess is that your command line may not be set to UTF-8, which is
the charset consistently used throughout Ecere. Try making a form,
putting an EditBox in it, and using editBox.SetText to set it to the
contents. My guess is that this will render correctly. In any case,
see if you can configure your command line to use UTF-8.
> 3.
> 1).enum examples in the book
> enum Planet{mercury,venus,earth,mars,jupiter,saturn,uranus,neptune};
> enum PlanetOrDwartPlanet:Planet{ceres,pluto,eris};
> Your comments in the book say that ceres will be 8,and so on.But when
> I pint it ,it is 0.
Indeed, I can confirm this. Not only does ceres start at zero, but
PlanetOrDwartPlanet::enumSize is 3 instead of 8+3 = 11.
> 2).Is it possible to add implementation something like
> enum.toString() to print the enum variable's rep. content other than
> the value in integer.For example:
> Planet p=mercury;
> printf("%d\n",p)//===>output is 0;
> printf(%s\n",p.toString())===>output is :mercury.
I agree. Moreover, perhaps the array of all the enum values should be
available, too:
char *enumNames[] = Planet::enumNames; //contains this array:
{"mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus",
"neptune"}
However, I'd imagine the .toString would be convenient for a whole lot
of applications, so this would be an extension rather than a
substitute. Planet::enumNames[p] is a little unclear :)
For the UTF-8 question...
It seems that you are using Windows, then...
First, if you could check the
[ControlPanel->RegionalAndLanguageOptions->Language->TextServiceAndInputLanguages->Detail->Advanced],
then make sure that options in the [CompatibilityConfiguration] is
checked, and the [SystemConfiguration->TurnOffAdvancedTextServices] is
unchecked.
Then, go to [ControlPanel->Display->Appearance->Advanced], and make
sure all window texts are using a font that support UTF-8.
It could happen that the system wants you to put back in your
installation CD if you are using one of the European language versions
of Windows.
Try Ubuntu pal. If I can also suggest.
Regards
Quan
2008/8/5 Sam Hu <SamHu...@gmail.com>:
--
********************************************
What is a bird?
--"Grzimek's Encyclopedia of Birds".
********************************************