Hi,
First my code:
bestand.dat contains the textCode:#include <stdio.h> main() { FILE *stream; char dude[7]; int w; stream = fopen( "C:\\bestand.dat", "r" ); while( !feof( stream )) { fscanf( stream, "%s", dude ); printf("%s ", dude ); } fclose( stream ); getche(); }
Now, my question,Schrijven in een data bestand
the word 'Schrijven' contains 10 characters \0 included.
But i only declared dude[7], so basically 'Schrijven' wont fit into the variable dude.
Is this because fscanf ( like scanf ) doenst check the buffer so an buffer overflow can occur?
Just to make something clear
Thanks for your time
Encrypted



LinkBack URL
About LinkBacks


