Not sure why I am getting an error here

I did some more debugging and im running into an error at this section of my code. This is the error i got, im not sure why. I think it might be because im not storing the values to the dynamic memory properly.
21 Replies
The Many
The Many3y ago
try getting rid of the size, just new double
Revan
RevanOP3y ago
im still getting the same error
The Many
The Many3y ago
i didn't sleep last night so sorry if i'm missing something but i don't think your if condition makes sense
The Many
The Many3y ago
If the title and mark are both NULL (missing), then store and allocate them? try just setting the result of the read functions to a boolean and then use that as the condition
Revan
RevanOP3y ago
yeah this is what i did orignally but i still got an error
The Many
The Many3y ago
c++
bool doubleRead = read(localDble, fptr);
bool charRead = read(localChar, fptr);
// ...
if(doubleRead && charRead) {
//...
}
c++
bool doubleRead = read(localDble, fptr);
bool charRead = read(localChar, fptr);
// ...
if(doubleRead && charRead) {
//...
}
Revan
RevanOP3y ago
Oh I see, I’ll try that out
The Many
The Many3y ago
Any improvement? Sorry dinner arrived
Revan
RevanOP3y ago
Yeah sorry i went on a run I’ll try to run it, later tonight yeah still getting an error i did the debuggin again and it seems my program crashes when i tried to delete the dynamic memroy
Revan
RevanOP3y ago
Revan
RevanOP3y ago
the program crashes right when i do delete aptr[i].mark @the.many
The Many
The Many3y ago
that block looks okay to me, can i see the actual m_mark when you first assign it?
Revan
RevanOP3y ago
The Many
The Many3y ago
c++
//new char[cStringSize];
new char[strlen(localChar) + 1];
c++
//new char[cStringSize];
new char[strlen(localChar) + 1];
the size of the string is not consistent and the memory is dynamically allocated so i think you have to do it like that i think this can just be
c++
//new double [n]
new double;
c++
//new double [n]
new double;
c++
//Asm.m_mark = &localDble;
*Asm.m_mark = localDble;
c++
//Asm.m_mark = &localDble;
*Asm.m_mark = localDble;
Revan
RevanOP3y ago
ok now i can go throug the loop one time but at the second iteration it breaks
The Many
The Many3y ago
hmm. check how it's counting up i guess. i have to run
CaramelCorn
CaramelCorn3y ago
ooh we debugging in here I never notice these forum threads
The Many
The Many3y ago
maybe you can solve the last piece i think that was all the stuff i could notice, but i gotta go
CaramelCorn
CaramelCorn3y ago
gn!
The Many
The Many3y ago
night o/
Revan
RevanOP3y ago
tyty I figured it out thanks for the help @the.many
Want results from more Discord servers?
Add your server