R
Ruud
Hallo allemaal,
In my Pascal program I gathered all messages in one function. All
messages have their own number. One of the advantages of this method
is that if someone wants to change a messages, he only has to look in
one place.
The function is declared as follow:
function zin(by : byte) : string;
A line calling the function can look like as simple as
this:
writeln(zin(12));
So far I have found a replacement for this function but I'm not
satisfied with it. I defined a 'char pst[255]' and the function 'void
zin(int by)' fills pst with the wanted message. But that means I now
need two lines instead of one:
zin(12);
printf("%s", pst);
Of course I tried to turn 'void zin(int by)' into a funtion that
returns a value so I could combine those two line to something like
'printf("%s", zin(12));' but I either got an compilation error or only
nonsense appeared on the screen.
In the meanwhile I found a solution in the form of
char *zin[20] = { "..", ""..." etc. }
printf("%s", zin[12]);
But that works fine for fixed messages but what about messages that
are generated by a function on the fly?
Any help is welcome!
--
___
/ __|__
/ / |_/ Groetjes, Ruud Baltissen
\ \__|_\
\___| http://Ruud.C64.org
In my Pascal program I gathered all messages in one function. All
messages have their own number. One of the advantages of this method
is that if someone wants to change a messages, he only has to look in
one place.
The function is declared as follow:
function zin(by : byte) : string;
A line calling the function can look like as simple as
this:
writeln(zin(12));
So far I have found a replacement for this function but I'm not
satisfied with it. I defined a 'char pst[255]' and the function 'void
zin(int by)' fills pst with the wanted message. But that means I now
need two lines instead of one:
zin(12);
printf("%s", pst);
Of course I tried to turn 'void zin(int by)' into a funtion that
returns a value so I could combine those two line to something like
'printf("%s", zin(12));' but I either got an compilation error or only
nonsense appeared on the screen.
In the meanwhile I found a solution in the form of
char *zin[20] = { "..", ""..." etc. }
printf("%s", zin[12]);
But that works fine for fixed messages but what about messages that
are generated by a function on the fly?
Any help is welcome!
--
___
/ __|__
/ / |_/ Groetjes, Ruud Baltissen
\ \__|_\
\___| http://Ruud.C64.org