Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main()
- {
- FILE *fp;
- fp = fopen("liczby3.dat", "w + b");
- srand(time(NULL));
- int i, x, buf;
- for(i = 0; i < 10; i++)
- {
- x = rand() % 20;
- fwrite(&x, sizeof(int), 1, fp);
- }
- while(fread(&buf, sizeof(int), 1, fp))
- printf("%d, ", buf);
- FILE *fp1;
- fp1 = fopen("kopia.dat", "w + b");
- fseek(fp,0,0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement