-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional Values #47
Comments
Hi,
does the following code work for you?
int a, b, c;
char*b_str;
while(in.read_row(a,b_str,c)){
if(*b_str == '\0'){
// No b
} else {
b = atoi(b_str);
// there is a b
}
}
Best Regards
Ben Strasser
…On 07/11/2017 12:22 AM, Ben Segal wrote:
I have a |.csv| file with data that looks like the following:
|a,b,c 1,2,3 1,,3 1,2,3 |
I'd like to know that there's no |b| value for the second line (rather than interpreting it as |0|). Is it possible to do this?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#47>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ALaAj7AmzL663O_LoRGakYDmwkJpVpFaks5sMqQ-gaJpZM4OTflq>.
|
I would like to know what will happen in case of 'b' value is not present.
|
As stated in the top comment: The default is interpret an empty field as zero value. If you want something else you must read a char* and do the parsing yourself. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a
.csv
file with data that looks like the following:I'd like to know that there's no
b
value for the second line (rather than interpreting it as0
). Is it possible to do this?The text was updated successfully, but these errors were encountered: