fork download
  1. #include <stdio.h>
  2.  
  3. int InitMap();
  4. int LoadMapData();
  5. int SaveMapData();
  6.  
  7. unsigned char Map[100][100];
  8.  
  9. int main()
  10. {
  11. InitMap();
  12. LoadMapData();
  13. // 編集・表示などをする
  14. SaveMapData();
  15. return 0;
  16. }
  17.  
  18. int InitMap()
  19. {
  20. int x, y;
  21. for(y = 0; y < 100; ++y){
  22. for(x = 0; x < 100; ++x){
  23. Map[x][y] = (unsigned char)0;
  24. }
  25. }
  26. return 0;
  27. }
  28.  
  29. int LoadMapData()
  30. {
  31. int x, y;
  32. for(y = 0; y < 100; ++y){
  33. for(x = 0; x < 100; ++x){
  34. Map[x][y] = getc();
  35. if(feof(stdin)){
  36. return -1;
  37. }
  38. }
  39. }
  40. return 0;
  41. }
  42.  
  43. int SaveMapData()
  44. {
  45. int x, y;
  46. for(y = 0; y < 100; ++y){
  47. for(x = 0; x < 100; ++x){
  48. putc(Map[x][y]);
  49. }
  50. }
  51. return 0;
  52. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from prog.c:1:0:
prog.c: In function 'LoadMapData':
prog.c:34:19: error: too few arguments to function '_IO_getc'
       Map[x][y] = getc();
                   ^
In file included from /usr/include/stdio.h:74:0,
                 from prog.c:1:
/usr/include/libio.h:434:12: note: declared here
 extern int _IO_getc (_IO_FILE *__fp);
            ^
prog.c: In function 'SaveMapData':
prog.c:48:21: error: macro "putc" requires 2 arguments, but only 1 given
       putc(Map[x][y]);
                     ^
prog.c:48:7: warning: statement with no effect [-Wunused-value]
       putc(Map[x][y]);
       ^
stdout
Standard output is empty