strtol with hex greater than 4 byte ?
From: Peter Dunker (Peter.Dunker_at_stud.tu-ilmenau.de)
Date: 04/29/04
- Next message: Robert Bachmann: "Re: Rob Pike's simple Include rule"
- Previous message: James Hu: "Re: Math Question"
- Next in thread: Case: "Re: strtol with hex greater than 4 byte ?"
- Reply: Case: "Re: strtol with hex greater than 4 byte ?"
- Reply: Dan Pop: "Re: strtol with hex greater than 4 byte ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 29 Apr 2004 16:38:04 +0200
Hi,
I will check a String which should contain a HEX value.
I know that strtol is the right function for this job.
But what happens when I will check a hex string with 8 bytes?
That I can check that the string is correct i know.
long value;
char src[]="0x1234567812345678"
char *err;
value = strtol(src,&err, 16);
if (*err != 0x00)
return -1; /*FEHLER*/
The value is not 0x12345678 but I know it is right spelled.
Is that C89 standard or only on my compiler/OS (VC6, Windows) ?
Is there a way to get the right value of the beginning of the string,
up to the sizeof(long) ?
Thx
Peter
- Next message: Robert Bachmann: "Re: Rob Pike's simple Include rule"
- Previous message: James Hu: "Re: Math Question"
- Next in thread: Case: "Re: strtol with hex greater than 4 byte ?"
- Reply: Case: "Re: strtol with hex greater than 4 byte ?"
- Reply: Dan Pop: "Re: strtol with hex greater than 4 byte ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|