Source.c 464 B

12345678910111213141516171819202122232425262728293031
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <Windows.h>
  4. int main()
  5. {
  6. FILE* file = NULL;
  7. int number;
  8. file = fopen("bin.bin", "wb");
  9. if (file == NULL) {
  10. printf("Error opening file");
  11. }
  12. scanf("%d", &number);
  13. fwrite(&number, sizeof(int), 1, file);
  14. fclose(file);
  15. file = fopen("bin.bin", "rb");
  16. if (file == NULL) {
  17. printf("Error opening file");
  18. }
  19. fread(&number, sizeof(int), 1, file);
  20. printf("%d", number);
  21. fclose(file);
  22. }