Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
unix
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
tu-wien
unix
Commits
0e2c89d9
Commit
0e2c89d9
authored
Dec 15, 2018
by
Ivaylo Ivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert to old line check
parent
a7b4aa82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
cpair/cpair.c
cpair/cpair.c
+6
-6
No files found.
cpair/cpair.c
View file @
0e2c89d9
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment