Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program that modifies a binary file of a fuck tonne of numbers
- #include <stdio.h>
- #include <stdlib.h>
- #define SIZE 1000
- main()
- {
- FILE *fp;
- int numArray[SIZE]={0};
- int zero[1]={0};
- int i;
- fp=fopen("num1000.bin","r+b");
- fseek (fp,2*sizeof(int),SEEK_SET);
- fwrite (zero,sizeof(int),1,fp);
- fseek (fp,9*sizeof(int),SEEK_SET);
- fwrite (zero,sizeof(int),1,fp);
- rewind(fp);
- fread(numArray,4,SIZE,fp);
- for (i=0;i<SIZE;i++)
- {
- printf("%d ",numArray[i]);
- }
- fclose(fp);
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement