title: Rename() function not working when attempting to add an extension to a file
body: <p>I have an extension-less file and I want to add an <code>.avi</code> extension to it. So I call this function after selecting the file via openfile dialog (I want to have the file opened after renaming):</p>
  
  <pre><code>int RenameVidAddExt(HWND hWnd, char oldname[MAX_PATH])
  {
      int filenamesize=0, n=0;
      char extension [] = ".avi";
      char* newname;
  
      for (n=0 ; oldname[n]!=NULL ; n++)
      {
          filenamesize++;                                 
      }
  
      newname = new char[filenamesize+sizeof(extension)];
  
      newname = oldname;
      strcat (newname, extension);
      //SetDlgItemTextA(hWnd, IDC_EDIT1, szFile);     //test print of filenameof selected file
      //SetDlgItemTextA(hWnd, IDC_EDIT2, newname);    //test print of newname
      rename(oldname,newname);
      return 0;
  }
  </code></pre>
  
  <p>The filename just doesn't change and I don't know why. Test prints show that both <code>oldname</code> and <code>newname</code> contain correct strings (old without extension and new with it).</p>