Timeline for C program to write 5 lines to a file then print the lines except the second line
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 21, 2017 at 3:43 | comment | added | 200_success |
For one thing, a variable whose name is flag tells me little about what its purpose is. For another, code that has flag variables can almost always be better expressed without them. It's hard to explain; you should just look at an overwhelming number of examples.
|
|
Apr 20, 2017 at 17:21 | comment | added | user127566 | Why avoid flag variables? | |
Apr 20, 2017 at 17:20 | vote | accept | CommunityBot | ||
Apr 20, 2017 at 16:52 | comment | added | cHao | Here's hoping... | |
Apr 20, 2017 at 16:41 | comment | added | 200_success |
@cHao That's true, but write_to_file() has the same weakness with long lines. It's unfortunate that the C standard does not include the getline() function of GNU libc.
|
|
Apr 20, 2017 at 15:27 | comment | added | cHao | Only problem with working with "lines" as opposed to chars, is if a "line" exceeds 1024 chars in length. (You can check for that, but if you know and/or control the data, it might not be worth the trouble to handle that case.) | |
Apr 20, 2017 at 13:48 | history | edited | 200_success | CC BY-SA 3.0 |
added 150 characters in body; added 1 character in body
|
Apr 20, 2017 at 13:40 | history | answered | 200_success | CC BY-SA 3.0 |