J
J. (Hans) D. Lodder
Hi!
Recently I have been re-reading my KR1 book to refresh my C knowledge
(yes indeed, quite rusty!).
Regarding this I have a couple of questions. I a busy writing a C
program, which I want to be relatively robust.
1. Memory allocation and freeing
Are alloc() and free() still the safest options?
2. Read 1 line of input
Is getline() still the safest option?
3. Printing error messages and aborting
Is my best option fprintf (stderr, "msg") and exit (1)?
It is not only an answer I am looking for, but also why, including
possible examples and references.
Can you help me?
Kind regards,
Hans Lodder
Recently I have been re-reading my KR1 book to refresh my C knowledge
(yes indeed, quite rusty!).
Regarding this I have a couple of questions. I a busy writing a C
program, which I want to be relatively robust.
1. Memory allocation and freeing
Are alloc() and free() still the safest options?
2. Read 1 line of input
Is getline() still the safest option?
3. Printing error messages and aborting
Is my best option fprintf (stderr, "msg") and exit (1)?
It is not only an answer I am looking for, but also why, including
possible examples and references.
Can you help me?
Kind regards,
Hans Lodder