If I red this correctly, you're really saying that you need to return an int, but you also need to be able to detect an error. there are two common ways of doing this: putting the return value in an argument passed by reference, or adding another method to set/get errors.
For the first, it would be something like
int myfcn(int* result, char[] input) {
// do stuff
...
if( success ) {
*result = ...;
return ERROR_SUCCESS;
} else {
return ERROR;
}
}
The second would look like...
void caller() {
int value = TokenToInt(...);
if( getLastError() != ERROR_SUCCESS ) {
// handle the error
}
}
int TokenToInt(...) {
// do stuff
if( error ) {
setLastError(ERROR_WHATEVER);
return result
}
return result;
}
You can look up the getLastError function for additional details.