Hi,

I try to print a float simply by doing :

[
 3.4 putln.
]

So I had to implement those 2 methods:

Float printOn: aStream
[
    | s |
    {
        double rcvr;
        int i = 79;
        v_s = _libid->balloc(i + 1);
        char *buffer = (char*)v_s;
        memcpy(&rcvr, self, sizeof(double));

        snprintf(buffer, 79, "%f", rcvr);
        while (buffer[i] == '\0')
          {
              i--;
          }
        while (buffer[i] == '0')
          {
            i--;
          }
        if(buffer[i] == '.')
          {
            buffer[i + 2] = '\0';
          }
        else
          {
              buffer[i + 1] = '\0';
          }
    }.
    aStream nextPutAll: (String value_: s)
]

Float put
[
    self printString put
]


Is there an other way to print float in the shell?

Thanks

- Mathieu Suen
- [email protected]


        

        
                
___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com


_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to