Enviado em 12/01/2023 - 03:16h
Bom dia a todos!#include <stdio.h>
int main(void) {
FILE *Destiny = fopen("/etc/rc.d/rc.inet1.conf_Original", "wb");
if(!Destiny) {
FILE *Source = fopen("/etc/rc.d/rc.inet1.conf", "rb");
for(int Char; (Char = getc(Source)) != EOF; )
fputc(Char, Destiny);
fclose(Source );
fclose(Destiny);
} else {
fclose(Destiny);
puts("O Backup já existe!");
}
}
bash-5.2$ gcc test.c -o test -O3 -Wall -pedantic -pedantic-errors -Werror
test.c: In function 'main':
test.c:11:10: error: argument 2 null where non-null expected [-Werror=nonnull]
11 | fputc(Char, Destiny);
| ^~~~~~~~~~~~~~~~~~~~
In file included from test.c:2:
/usr/include/stdio.h:549:12: note: in a call to function 'fputc' declared 'nonnull'
549 | extern int fputc (int __c, FILE *__stream);
| ^~~~~
cc1: all warnings being treated as errors