Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Problem reading strings from file

Author
Message
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 11th Jun 2009 09:15
'Lo, I'm trying to load a list of names into an array of char*'s, and it's giving me problems.

This is my code:



Planet[p].Name is defined as a char*, and I get an access violation writing location error at 'PlanetNames >> SolarSystem[i].Planet[p].Name;'

Any help would be appreciated, thanks

Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 11th Jun 2009 10:02
Nevermind, I just declared Planet.Name as a string instead of char*, and it worked fine.

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 11th Jun 2009 18:53
Just for the record, if Planet.Name is a char * it needs to reference space that was declared when created or space that was allocated using the new key word. If it isn't pointing to anything valid it means your code is trying to write to unknown space.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office

Login to post a reply

Server time is: 2024-11-25 08:33:11
Your offset time is: 2024-11-25 08:33:11