Thema: C++ strcpy problem

Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#1

strcpy problem

  Alt 22. Sep 2015, 11:48
Bekomme Zugriffsverletzung beim kopieren des String.
Zitat:
Unhandled exception at 0x59CD40D9 (msvcr120d.dll) in TestBassVis.exe: 0xC0000005: Access violation writing location 0x00000072.
Code:
char GetCurrentDir()
{
  char szCurrentDir[MAX_PATH];
  int i = GetCurrentDirectory(255, (LPWSTR)szCurrentDir);
  if (szCurrentDir[i - 1] == '\\')
   szCurrentDir[i - 1] = 0;

  return szCurrentDir[i];
}
Code:
char* Path = "\\SPlugins\\Visual Ball\\Ball.svp";
strcpy((char*) GetCurrentDir(), Path);

exec.Pluginfile = Path;
Ich möchte den Aktuellen Pfad vor "\\SPlugins\\Visual Ball\\Ball.svp"; kopieren.
Geht das überhaupt?

Leider krachts.

gruss

Geändert von EWeiss (22. Sep 2015 um 12:15 Uhr)
  Mit Zitat antworten Zitat