[vorbis-dev] ogg123 -k 1:59 patch.ogg # minutes and seconds

Hans Schou chlor at schou.dk
Thu Mar 6 00:17:36 PST 2003



On Tue, 4 Mar 2003, Segher Boessenkool wrote:

> Hans Schou wrote:
> > Thanks! It should not be 'const',
> > otherwise it is fine.
> 
> Just curious: why does 'const' not work?

gcc did not like it - there was an error.

minsec.c:9: warning: passing arg 2 of `strtod' from incompatible 
pointer type

Here is my test program:
#include <stdio.h>
#include <stdlib.h>

double strtotime(const char *s)
{
        double time;
        time = strtod(s, &s);
        while (*s == ':')
                time = 60 * time + strtod(s + 1, &s);
        return time;
}

int main (void) {
        printf("0 %.3f\n", strtotime("0") );
        printf("1 %.3f\n", strtotime("1") );
        printf("0.4 %.3f\n", strtotime("0.4") );
        printf(".4 %.3f\n", strtotime(".4") );
        printf("1.2 %.3f\n", strtotime("1.2") );
        printf("3:1.2 %.3f\n", strtotime("3:1.2") );
        printf("1:3:2 %.3f\n", strtotime("1:3:2") );
}

best regards/hans

-- 
Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
--------------------------------------------------------------
Please don't call me at all, (E-)mail is sufficient)
				-- Anne Bezemer
--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis-dev mailing list