You're not null-terminating your string temp
. Add this:
temp[i - 1] = '\0';
bi = bigint(temp);
Note the -1
will remove the semicolon that you probably don't need either. If you want to keep the semicolon there for whatever reason, change it to temp[i]
.
You should also add a check to your while loop to make sure you don't overflow your buffer size.