![]() |
|
Replaceing fread() with al_fread()) |
nshade
Member #4,372
February 2004
|
I'm getting a bad pointer (read access violation) with the following code 1#include <allegro5/allegro.h>
2#include <stdio.h>
3
4ALLEGRO_FILE *solfile;
5
6int main(int argc, char **argv)
7{
8
9 unsigned char tbuf[70];
10 int blen;
11
12 if (!al_init()) {
13 printf("Could not init Allegro.\n");
14 }
15
16 blen = 68;
17 solfile = fopen("rules.sol", "rb");
18 if (solfile == NULL) return(true);
19 al_fread(solfile, tbuf, blen); // <----crashes here
20 al_fclose(solfile);
21
22 return 0;
23}
Not getting this.. tbuf as enough space in the array, ([70] bytes)and blen is only 68. Why is this crashing? ===EDIT=== |
|