I am getting an access violation. Can anyone see why this might occur
in the following code fragment from a GUID generator?
// here is a code fragment fro a GUID creation routine.
// it is crashing with an Access violation
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
char* guidStr = "{00000000-0000-0000-0000-000000000000}";
void GenerateGuid()
{
char *pGuidStr = guidStr;
int i;
srand(static_cast<unsigned int> (time(NULL))); /*Randomize based on time.*/
/*Data1 - 8 characters.*/
system("PAUSE"); // code gets to here okay
*pGuidStr++ = '{'; // <code crashes here
// Code Crashes when it trys to access guidStr before it gets to here.
// Unhandled exception at 0x00411486 in XorCryt.exe: 0xC0000005: Access violation writing location 0x0041573c.
system("PAUSE");
}
Thanks in advance for any help.