-
structures, pointers to structures, and the write() member function
Hello Everyone!!!
I have a serious problem. I know this may sound a bit amateurish, but I am really stuck. I have a dynamically allocated array of structures, and have to print it to a file using binary output. The problem is I keep getting a "Stack Exception" error in the "Write(1)...memorey address". Here is my current code:
outbin.write((char *)studRecPtr, sizeof(studRecPtr[loopIt]));
Any help would be highly appreciated. Thank you.
-
Confused
Re: structures, pointers to structures, and the write() member function
Originally posted by 9933515
Hello Everyone!!!
I have a serious problem. I know this may sound a bit amateurish, but I am really stuck. I have a dynamically allocated array of structures, and have to print it to a file using binary output. The problem is I keep getting a "Stack Exception" error in the "Write(1)...memorey address". Here is my current code:
outbin.write((char *)studRecPtr, sizeof(studRecPtr[loopIt]));
Any help would be highly appreciated. Thank you.
You could try:
outbin.write((char*)studRecPtr, NrOfStructs * sizeof(STRUCTBASE));
if you have typedef:ed your struct
typedef struct
{
...
}STRUCTBASE;
STRUCTBASE* studRecPtr;
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
-
how does this write function work?
what header?
-
Confused
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
-
Try:
outbin.write((char *)studRecPtr[loopIt], sizeof(studRecPtr[loopIt]));
-
i figured it out!!!!!! thanks for your help!!!!!
Popular pages
Recent additions