reading binary file

hi all
i'm trying to open a file as binary using this command:
FILE* testRead = fopen ("test.txt", "rb");
and read a structure from the file:
struct msq_type
{
char * q;
char * a;
char * b;
char * c;
char * d;
char result;

}
by using the command
fread(&qusetion , sizeof qusetion , 1 , testRead);

but i'm having a problem that display the following message
http://img245.imageshack.us/img245/7682/errormessageq.jpg

here's the full code:



// ReadingFromFiles.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <cctype>
#include <cstring>
#include <stdio.h>
#include <cmath>
#include <fstream> //for reading files
#include <cstdlib> //using function for shut down
using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

struct msq_type
{
char * q;
char * a;
char * b;
char * c;
char * d;
char result;

} qusetion;

//struct msq_type qusetion;
printf("begining \n");
FILE* testRead = fopen ("test.txt", "rb"); //rb = read
printf("opening file \n");
if(testRead==NULL) {
printf("Error: can't open file.\n");
system("pause");
return 1;
}

fread(&qusetion , sizeof qusetion , 1 , testRead);
printf("reading \n");
printf("%s \n", qusetion.q);
printf("%s \n" , qusetion.a);
printf("%s \n", qusetion.b);
printf("%s \n", qusetion.c);
printf("%s \n", qusetion.d);
printf("%c \n", qusetion.result);
fclose(testRead);
printf("closeing file");



return 0;
}






and here's the output:
http://img168.imageshack.us/img168/7049/output2.jpg


thanx in advance,,
Topic archived. No new replies allowed.