Help with variables...
Posted on 2006-11-06
I'm having issues with variables...
I am trying to load some configuration information from a text file and use it elsewhere in my application.
Here are snipets from the code:
char * CIP = "000.000.000.000";
char* IpAddress = CIP;
if ((err = fopen_s(&instream, "config.txt", "r")) != 0)
Memo1->AppendText("Configuration file failed to open.\r\n");
Memo1->AppendText("Configuration file successfully opened.\r\n");
fscanf(instream, "%s\n", CIP);
I am getting an "attempted to read or write to protected memory" error when compiling. I know this has to do with pointers and such, but I've never been good with them and I'm stumpted on this one.
I am not able to change the CIP decleration or usage as the other 2000 lines of code work with it as it is. What I need is the read the first line of the text file and then assign that information to the CIP variable.
Any help you be appreciated as this problem is urgent...