Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- int main()
- {
- FILE* fp2;
- fopen_s(&fp2, "rez.bin", "wb");
- int a[3][3] = { {1,2,3}, {1,2,3}, {1,2,3} };
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++) {
- fwrite(&a[i][j], sizeof(int), 1, fp2);
- }
- }
- fclose(fp2);
- fopen_s(&fp2, "rez.bin", "rb");
- int b[3][3] = { 0 };
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++) {
- fread(&b[i][j], sizeof(int), 1, fp2);
- printf_s("%d ", b[i][j]);
- }
- printf_s("\n");
- }
- fclose(fp2);
- scanf_s("%d", &a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement