Commit 0e2c89d9 authored by Ivaylo Ivanov's avatar Ivaylo Ivanov

Revert to old line check

parent a7b4aa82
...@@ -90,14 +90,14 @@ int main(int argc, char *argv[]) { ...@@ -90,14 +90,14 @@ int main(int argc, char *argv[]) {
node_t * current = head; node_t * current = head;
while(fgets(input, __INT8_MAX__, stdin) != NULL) { ///< Read line by line while(fgets(input, __INT8_MAX__, stdin) != NULL) { ///< Read line by line
char *sep, *end; /// Split the input by whitespace as delimiter
float x = strtof(input, &sep); ///< if no characters were converted then input will point to end char *x = strtok(input, " ");
float y = strtof(sep, &end); char *y = strtok(NULL, " ");
if(input != sep || sep != end) { if(x != NULL && y != NULL) {
/// Convert to float and save to the list /// Convert to float and save to the list
current -> points[0] = x; current -> points[0] = strtof(x, NULL);
current -> points[1] = y; current -> points[1] = strtof(y, NULL);
current -> next = malloc(sizeof(node_t)); current -> next = malloc(sizeof(node_t));
current = current -> next; current = current -> next;
point_num++; ///< Increase the list length point_num++; ///< Increase the list length
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment