title: Basic C++ Linked list nodes & Pointer Probs
body: <p>I've been having trouble trying to retrieve data from the first node in my linked list for quite some time now. Forgive me, but I am still new to C++ and especially pointers and linked lists.</p>
  
  <p>Here is how I am reading the data from my text file (working fine so far)</p>
  
  <pre><code>void readFile(ifstream&amp; budgetFile, budgetItem *newNode, int&amp; counter, budgetItem *temp, budgetItem *header)
  {
  char pauseChar;
  
  int ctype;
  string cname;
  double camount;
  char cleared;
  
  itemPtr listTop = NULL;
  
  while (!budgetFile.eof())
  {
  
      //newNode = new budgetItem;
  
      budgetFile &gt;&gt; ctype &gt;&gt; cname &gt;&gt; camount &gt;&gt; cleared;
  
      newNode-&gt;theType = ctype;
      cout &lt;&lt; newNode-&gt;theType &lt;&lt; endl;
      //cout &lt;&lt; ctype &lt;&lt; endl;
      newNode-&gt;name = cname;
      cout &lt;&lt; newNode-&gt;name &lt;&lt; endl;
      newNode-&gt;amount = camount;
      cout &lt;&lt; newNode-&gt;amount &lt;&lt; endl;
      if (cleared == 'Y') {
          newNode-&gt;cleared = true;
      }
      else{
          newNode-&gt;cleared = false;
      }
  
      newNode-&gt;next = listTop;
      listTop = newNode;
  
      if (counter == 0)
      {
          header = newNode;
      }
  
      counter++;
  }
  
  return;
  }
  </code></pre>
  
  <p>And here is how I am trying to retrieve the data starting from the first node. It doesn't work at all. Any help on this would be appreciated.</p>
  
  <pre><code>void showBudget (budgetItem *newNode, budgetItem *temp, budgetItem *header)
  {
  double incomeTotal;
  double expenseTotal;
  double differenceTotal;
  
  //itemPtr *newlist;
  //newNode = header;
  itemPtr listTop;
  
  budgetItem *here = listTop;
  
  do {
      cout &lt;&lt; "INCOME:" &lt;&lt; endl;
      cout &lt;&lt; "      Item              Amount       Cleared" &lt;&lt; endl;
      cout &lt;&lt; "      ----------------  -------      -------" &lt;&lt; endl;
      if (newNode == NULL)
      {
          cout &lt;&lt; "List is empty." &lt;&lt; endl;
      }
      else
      {
          if (newNode-&gt;theType != 0)
          {
              cout &lt;&lt; "       " &lt;&lt; newNode-&gt;name &lt;&lt; setw(23) &lt;&lt; fixed &lt;&lt; setprecision(2) &lt;&lt; newNode-&gt;amount &lt;&lt; "        ";
              if (newNode-&gt;cleared == true) {
                  cout &lt;&lt; "no" &lt;&lt; endl;
              }
              else{
                  cout &lt;&lt; "yes" &lt;&lt; endl;
              }
          }
          else{
              cout &lt;&lt; endl;
          }
      }
      newNode = newNode-&gt;next;
  } while (newNode != NULL);
  
  cout &lt;&lt; "End of List." &lt;&lt; endl;
  
  return;
  }
  </code></pre>