Junk Data in array after reading file.

I'm having issues with reading in a file into the a 1 dimensional char array.
I've used the fseek function to get the length of the file and created the char array based on that.

FILE *indata;
string line;
indata = fopen("../fshader2.txt", "r");

int numb = 0;
fseek(indata, 0, SEEK_END);
numb = ftell(indata);
rewind(indata);

char fsrc[numb+1];

Then I started storing the contents of the file into the char fsrc with this:

for(int x = 0; x < numb; ++x){
fsrc[x] = getc(indata);
}fclose(indata);

For some reason when I printed the fsrc to see the contents I get these odd symbols tacked onto the end of the file that I'm reading in:
The contents of what the file has:

varying highp vec4 texc;
uniform sampler2D tex1;
uniform sampler2D tex2;
void main(void)
{
highp vec4 color = vec4(0.0,0.0,0.0,1.0);
color.r = (texture2D(tex1, texc.st).r)/500.0;
color.g = (texture2D(tex2, texc.st).r)/10.0;
color.b = 0.0;
gl_FragColor = color;
}ÿÿÿÿÿÿÿÿÿÿ

Can anyone help me here?
you forgot to put the 0 at the end of your string in 'fsrc' after you read the data
Topic archived. No new replies allowed.