Marking path in my maze
<p>Im trying to mark the path through the maze. I'm stucked at this point. It only mark one way to the right. But the position when i write it out is X=1 Y=2. Its really strange. My idea was to make a while loop for the if statements but then the if statements not even run.. Please give me some ideas. </p>

<pre><code>if (strcmp(argv[1], "-input") == 0)
{
    ifstream ifs(argv[2]);
    if(!ifs)
    {
        cout &lt;&lt; "Felaktig textfil";
    }
    vector&lt;vector&lt;char&gt;&gt; maze;
    vector&lt;vector&lt;char&gt;&gt; path;
    string line;
    unsigned int j=0;
    while (!ifs.eof())
    {
        getline(ifs, line);
        maze.push_back(vector&lt;char&gt;());
        for (int i=0; i &lt; line.size(); i++)
        {
            maze[j].push_back(line[i]);
        }
        j++;
    }
    //cout &lt;&lt; maze.size();
    int startX,startY;

    for (int i = 0; i &lt; maze.size(); i++)
    {
        for (int j = 0; j &lt; maze[i].size(); j++)
        {
            if (maze[i][j] == 'S')
            {
                startX = j;
                startY = i;
                break;
            }
        }
    }
    if (startX + 1 &lt; maze.size() &amp;&amp; maze[startX + 1][startY] != '*')
    {
        startX++;
        maze[startY][startX]='x';
    }

    if (startX - 1 &gt; 0 &amp;&amp; maze[startX - 1][startY] != '*')
    {
        startX++;
        maze[startY][startX] = 'x';
    }

    if (startY - 1 &gt; 0 &amp;&amp; maze[startX][startY - 1] != '*')
    {
        startY--;
        maze[startY][startX] = 'x';
    }
    if (startY + 1 &lt; maze.size() &amp;&amp; maze[startX][startY + 1] != '*')
    {
        startY++;
        maze[startY][startX]='x';
    }
    if (maze[startY][startX]=='X')
    {
        cout &lt;&lt; "done";
    }
    cout &lt;&lt; startX &lt;&lt;startY &lt;&lt; endl;

    PrintMaze(maze);
}
</code></pre>
