Reputation: 629
I convert string to unsigned long like this code.
String t = "1667451600";
unsigned long ret;
ret = strtoul(t,NULL,10);
It show error like this.
test:122:19: error: cannot convert 'String' to 'const char*'
122 | ret = strtoul(t,NULL,10);
| ^
| |
| String
exit status 1
cannot convert 'String' to 'const char*'
How to canvert string to unsigned long in C ?
Upvotes: 0
Views: 525
Reputation: 1821
String
is not a standard type in C. Try this:
char *t = "1667451600";
unsigned long ret;
ret = strtoul(t,NULL,10);
Upvotes: 3