sorry forgot to change the subject. anyway i found out that the error actually in my binary reading program. so i manage to read the header bu calling this step:
fread(&headers, sizeof(MtexHeader), 1, fp); where mtexheader represent the header structure which contain the size of the file. when i try to grab the content of the file, i call fread(out, sizeAccordingToHeader, 1, fp); but it returns error each time i try to grab the content. Bad access. any idea why? thanks in advance ================================= http://www.svnstrk.blogspot.com ________________________________ From: Jos Timanta Tarigan <[email protected]> To: [email protected] Sent: Wed, August 4, 2010 5:36:18 PM Subject: Re: [c-prog] Re: array initialization hi, i got problem reading a binary file using c++. here is the code: http://pastebin.com/TPuLshZN the problem is when i call LoadMTex, i send a pointer (char* out) as the method parameter. then i put some values on the pointer (acting as an array). but when im out of the method, looping through the array in the main method, it gives me bad access. but when i call it inside the LoadMTex method, the array is copied (works properly). when you pass a pointer to a method, dont it copy the adress (pass by reference), hence if you make any value change on that, it also change the value from where the method called? anyone got hints? thanks in advance ================================= http://www.svnstrk.blogspot.com [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]
