[Scilab-users] mprintf("%c") actual action, and vs mprintf("%s") ?

classic Classic list List threaded Threaded
2 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] mprintf("%c") actual action, and vs mprintf("%s") ?

Hello,

The printf_conversion page tells that the ""%c" directive accepts and displays an integer value converted to a character".
Yet, with Scilab 6.1.0

--> msprintf("AB %c\n", 3)
msprintf: Wrong number of input arguments: data doesn't fit with format.

--> mprintf("AB %c\n", "5")
AB 5

--> mprintf("AB %c\n", "R")
AB R

--> mprintf("AB %c\n", "RB")
AB RB

So, what's the difference between the %c and %s printing formats?

The Scilab 5.5 behavior was the same, except that only the first character of the input was printed:

-->msprintf("AB %c\n", "RB")
 ans  =
 AB R  

Regards
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: mprintf("%c") actual action, and vs mprintf("%s") ?

Le 21/10/2020 à 20:12, Samuel Gougeon a écrit :

Hello,

The printf_conversion page tells that the ""%c" directive accepts and displays an integer value converted to a character".
Yet, with Scilab 6.1.0

--> msprintf("AB %c\n", 3)
msprintf: Wrong number of input arguments: data doesn't fit with format.

--> mprintf("AB %c\n", "5")
AB 5

--> mprintf("AB %c\n", "R")
AB R

--> mprintf("AB %c\n", "RB")
AB RB

So, what's the difference between the %c and %s printing formats?

In C language, %c expects an ascii code and converts it into the corresponding character.
But Scilab' implementation of this format does not match C's one.
This is reported as bug 16564. At least, Scilab's printf_conversion page could be more accurate.

Samuel



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users