Re: Reading a file...
EdUarDo wrote:[color=blue]
>
> Hello again, thanks to all for your answers. I've tried to follow
> all of your advices and this is the result:
>[/color]
.... snip ...[color=blue]
>
> // Opening the file
> if((fp = fopen("fichero_ test.txt", "rb")) != NULL) {
> // Reseve memory[/color]
.... snip long extended code ...[color=blue]
>
> } else {
> return EXIT_FAILURE;
> }[/color]
Here's a readability tip. When you have a long clause, and a short
clause, arrange to have the short clause first. That way the
reader can quickly determine what controls entry to any particular
clause. The above could be:
if (NULL == (fp = fopen("fichero_ test.txt", "rb")))
return EXIT_FAILURE;
else {
... long extended code ...
}
--
"The power of the Executive to cast a man into prison without
formulating any charge known to the law, and particularly to
deny him the judgement of his peers, is in the highest degree
odious and is the foundation of all totalitarian government
whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
EdUarDo wrote:[color=blue]
>
> Hello again, thanks to all for your answers. I've tried to follow
> all of your advices and this is the result:
>[/color]
.... snip ...[color=blue]
>
> // Opening the file
> if((fp = fopen("fichero_ test.txt", "rb")) != NULL) {
> // Reseve memory[/color]
.... snip long extended code ...[color=blue]
>
> } else {
> return EXIT_FAILURE;
> }[/color]
Here's a readability tip. When you have a long clause, and a short
clause, arrange to have the short clause first. That way the
reader can quickly determine what controls entry to any particular
clause. The above could be:
if (NULL == (fp = fopen("fichero_ test.txt", "rb")))
return EXIT_FAILURE;
else {
... long extended code ...
}
--
"The power of the Executive to cast a man into prison without
formulating any charge known to the law, and particularly to
deny him the judgement of his peers, is in the highest degree
odious and is the foundation of all totalitarian government
whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
Comment