[b][red]This message was edited by Ionline at 2003-6-29 4:29:34[/red][/b][hr]
I try to load .SQL file into char buffer.But am getting zunk characters
to the end along with EOF.Hence the command fails when its executed..Below is the code for it..
char * TestFile()
char *parkdat; /* ptr to buffer */
inp = fopen( "D:\MyDownLoads\Sql.sql", "r" );
/* get the file size */
fseek( inp, 0l, SEEK_END );
fsize = ftell( inp );
/* allocate buffer for whole file */
if ( (parkdat = (char*)malloc( fsize )) == NULL )
exit( 7 );
/* back to byte 0, read whole thing */
fseek( inp, 0l, SEEK_SET );
fread( parkdat, 1, fsize, inp );
fclose( inp );
//printf( "%s", parkdat );
I want to remove all the junk char plus the eof character from the buffer..
Any help is highly appreciated..