I am trying to write my 2D character array "A" into a .txt file "some_file.txt". I tried to use the Sergey Kalinichenko's answer from this question for my code (see below). However, it does not work. Could you please tell me what I am doing wrong.
#include <stdio.h>
#include <stdlib.h>
char A[10][10] =
{
  {'~', 'S', 'S', 'S', 'S', 'S', '~', '~', '~', 'S'},
  {'S', '~', '~', '~', '~', '~', '~', '~', '~', 'S'},
  {'S', '~', '~', 'S', 'S', 'S', '~', 'S', '~', '~'},
  {'S', '~', '~', '~', '~', '~', '~', 'S', '~', '~'},
  {'S', '~', 'S', 'S', 'S', '~', '~', '~', '~', '~'},
  {'~', 'S', '~', '~', '~', '~', '~', '~', '~', '~'},
  {'~', 'S', '~', '~', '~', '~', 'S', '~', '~', '~'},
  {'~', 'S', '~', '~', '~', '~', 'S', '~', '~', 'S'},
  {'~', 'S', '~', 'S', 'S', '~', '~', '~', '~', 'S'},
  {'~', '~', '~', '~', '~', '~', '~', '~', '~', 'S'}
};
void saveImage(int height, int width, char image[height][width], const char* file_name)
{
  FILE *file = fopen(file_name, "wb");
  fwrite(image, sizeof(char), sizeof(image), file);
  fclose(file);
}
int main()
{
  saveImage(10, 10, A, "some_file.txt");
  return 0;
}
 
     
     
     
    