A pointer is a pointer is a pointer; it is a fixed size and has nothing to do with the length of the item(s) that it is pointing to. You need to use your debugger to investigate why your program is crashing.
One of these days I'm going to think of a really clever signature.
I'm reading some string from a XML file and assigning it to a <code>const char*</code> variable.
That doesn't make sense. A pointer can only be sensibly initialized within the program, at runtime, because only then does the computer know where in memeory every object lies. Therefore it doesn't make sense to either store or restore a pointer to/from a file!
What you need to do instead is:
1. read that string from your file
2. Allocate a char array on the heap that is big enough to contain that string (including the terminating NULL character!)
3. Assign that array to your pointer
4. Store the string in that char array.
Of course, if you use std::string, that would save you some of that efort.
A pointer is just a pointer, just pointing to something. I think your application is crashing with some other reason. just debug the code and ensure what is the problem.. if you are using visual c++ just using LPCTSTR variable for storing string data read from xml.
In computer science, a pointer is a programming language data type whose value is directly linked to another - by means of pointing to the value that is stored elsewhere in the computer memory using its address.
The basic syntax is define a pointer is as follows:
Now, because a pointer points to a memory location - I don't believe that it can be define as long.
With Kind Regards,
Live Support Software for Business
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:43am.
Last Visit: 31-Dec-99 19:00 Last Update: 23-Nov-14 6:30