fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(){
  5. char sabun[10],name[10];
  6. int bonbong, soo, sang, result;
  7. FILE *fp1;
  8. if((fp1 = fopen("geubyu.txt", "w"))!=NULL){
  9. fprintf(" 회사원급여\n");
  10. fprintf("=========================================================\n");
  11. fprintf(" 사번 이름 본봉 수당 상여금 총액 \n");
  12. fprintf("---------------------------------------------------------\n");
  13. while((fscanf(fp1, "%s %s %d %d %d", &sabun, &name, &bonbong, &soo, &sang, &result)) != EOF ){
  14. result = bonbong + soo + sang;
  15. fprintf(fp1, "%s %s", sabun, name);
  16. fprintf(fp1, "%d %d %d %d \n", bonbong, soo, sang, result);
  17. }
  18. fprintf("---------------------------------------------------------\n");
  19. }else {
  20. printf("geubyu.txt파일이 존재하지 않음 \n");
  21. exit(0);
  22. }
  23. return 0;
  24. }
  25.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:9:14: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
      fprintf("                    회사원급여\n");
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:358:12: note: expected ‘FILE * restrict {aka struct _IO_FILE * restrict}’ but argument is of type ‘char *’
 extern int fprintf (FILE *__restrict __stream,
            ^~~~~~~
prog.c:9:6: error: too few arguments to function ‘fprintf’
      fprintf("                    회사원급여\n");
      ^~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:358:12: note: declared here
 extern int fprintf (FILE *__restrict __stream,
            ^~~~~~~
prog.c:10:14: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
      fprintf("=========================================================\n");
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:358:12: note: expected ‘FILE * restrict {aka struct _IO_FILE * restrict}’ but argument is of type ‘char *’
 extern int fprintf (FILE *__restrict __stream,
            ^~~~~~~
prog.c:10:6: error: too few arguments to function ‘fprintf’
      fprintf("=========================================================\n");
      ^~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:358:12: note: declared here
 extern int fprintf (FILE *__restrict __stream,
            ^~~~~~~
prog.c:11:14: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
      fprintf("    사번    이름    본봉    수당    상여금    총액 \n");
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:358:12: note: expected ‘FILE * restrict {aka struct _IO_FILE * restrict}’ but argument is of type ‘char *’
 extern int fprintf (FILE *__restrict __stream,
            ^~~~~~~
prog.c:11:6: error: too few arguments to function ‘fprintf’
      fprintf("    사번    이름    본봉    수당    상여금    총액 \n");
      ^~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:358:12: note: declared here
 extern int fprintf (FILE *__restrict __stream,
            ^~~~~~~
prog.c:12:17: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
         fprintf("---------------------------------------------------------\n");
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:358:12: note: expected ‘FILE * restrict {aka struct _IO_FILE * restrict}’ but argument is of type ‘char *’
 extern int fprintf (FILE *__restrict __stream,
            ^~~~~~~
prog.c:12:9: error: too few arguments to function ‘fprintf’
         fprintf("---------------------------------------------------------\n");
         ^~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:358:12: note: declared here
 extern int fprintf (FILE *__restrict __stream,
            ^~~~~~~
prog.c:13:30: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘char (*)[10]’ [-Wformat=]
         while((fscanf(fp1, "%s %s %d %d %d", &sabun, &name, &bonbong, &soo, &sang, &result)) != EOF ){
                              ^
prog.c:13:33: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘char (*)[10]’ [-Wformat=]
         while((fscanf(fp1, "%s %s %d %d %d", &sabun, &name, &bonbong, &soo, &sang, &result)) != EOF ){
                                 ^
prog.c:13:28: warning: too many arguments for format [-Wformat-extra-args]
         while((fscanf(fp1, "%s %s %d %d %d", &sabun, &name, &bonbong, &soo, &sang, &result)) != EOF ){
                            ^~~~~~~~~~~~~~~~
prog.c:18:17: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
         fprintf("---------------------------------------------------------\n");
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:358:12: note: expected ‘FILE * restrict {aka struct _IO_FILE * restrict}’ but argument is of type ‘char *’
 extern int fprintf (FILE *__restrict __stream,
            ^~~~~~~
prog.c:18:9: error: too few arguments to function ‘fprintf’
         fprintf("---------------------------------------------------------\n");
         ^~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:358:12: note: declared here
 extern int fprintf (FILE *__restrict __stream,
            ^~~~~~~
prog.c:21:6: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
      exit(0);
      ^~~~
prog.c:21:6: warning: incompatible implicit declaration of built-in function ‘exit’
prog.c:21:6: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
stdout
Standard output is empty