kosma / minmea

a lightweight GPS NMEA 0183 parser library in pure C
Do What The F*ck You Want To Public License
791 stars 253 forks source link

Why do you use custom hex2int function instead of strtol() from stdlib? #44

Closed Mkots closed 2 years ago

Mkots commented 5 years ago

You can use something like that for your minmea.c


int hex2int(char str[]){;
    char *endptr;
    int result;
    if(!(result = strtol(str, &endptr, 16))){
        result = -1;
    };
    return result;
}
cmorganBE commented 2 years ago

This is a good question. It's been a while since this was opened, closing due to that duration but we'd be interested in a PR if you'd like to improve this parsing code.