Revert to old line check
This commit is contained in:
parent
a7b4aa82a5
commit
0e2c89d939
@ -90,14 +90,14 @@ int main(int argc, char *argv[]) {
|
||||
node_t * current = head;
|
||||
|
||||
while(fgets(input, __INT8_MAX__, stdin) != NULL) { ///< Read line by line
|
||||
char *sep, *end;
|
||||
float x = strtof(input, &sep); ///< if no characters were converted then input will point to end
|
||||
float y = strtof(sep, &end);
|
||||
/// Split the input by whitespace as delimiter
|
||||
char *x = strtok(input, " ");
|
||||
char *y = strtok(NULL, " ");
|
||||
|
||||
if(input != sep || sep != end) {
|
||||
if(x != NULL && y != NULL) {
|
||||
/// Convert to float and save to the list
|
||||
current -> points[0] = x;
|
||||
current -> points[1] = y;
|
||||
current -> points[0] = strtof(x, NULL);
|
||||
current -> points[1] = strtof(y, NULL);
|
||||
current -> next = malloc(sizeof(node_t));
|
||||
current = current -> next;
|
||||
point_num++; ///< Increase the list length
|
||||
|
Reference in New Issue
Block a user