Hi,
I have found it hard to search for the solution, so as my last resource I'd like to show my problem to you. It basically comes down to that I have an array, a dynamic one. Each index of that array holds a set of coordinates (how many, I do not know). Later in my program I want to use those coordinates. The problem is, I thought I knew how I could access them, but apparantly I can't. I'll show you my code:
//Resize of ways
//Reset of coordinates array because here is a new way
while (startsWith(line, "<nd"))
{
//Resize of coordinates
//coordinates is set (a multiplicity of 2, even: lon-coordinate; odd: lat-coordinate)
}
ways[count_ways] = *coordinates;
ways_size[count_ways] = size_coordinates;
In a while loop, adds the value of the coordinates array because coordinates is dynamic.
for (unsigned int i = 0; i < count_ways; i ++)
{
if (ways_type[i] == 1)
{
for (unsigned int i2 = 0; i2 < ways_size[i]; i2 ++)
{
file_dest << "[" << *(&ways[i]+i2) << "]";
}
file_dest << ways_name[i];
file_dest << endl;
}
}
I write all the ways to the file, but I only get wrong coordinates (read, only incorrect lon coordinates).
I can't figure out why I point to the wrong variables in the last line.
I also find the outcome of the following test rather strange. I placed the following line of code right under the first block of code I've shown you:
cout << &ways[count] << " " << &(*coordinates) << endl;
It outputs 2 different numbers (but if I remove all &'s, they output the same).
I hope one of you can help me, because after trying many times, I haven't succeeded in doing it myself.
Greets,
Ragoune