I am using this simple..yet getting error.
to read a directory path from console window and then printing the path in window..
please do check why am getting unhandled exception error:
Error:Unhandled exception at 0x1029984f (msvcr90d.dll) in new_one.exe: 0xC0000005: Access violation reading location 0x745c3a46.
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#define MAX_PATH_LENGTH 256
int main(int argc, char *argv[])
{
int i;
int pathlength=100;
char *path=(char *)malloc(MAX_PATH_LENGTH);
free(path);
printf("Enter the path:");
scanf("%s",&path);
printf("%s",path);
getchar();
return 0;
}
Still i get the sam eexception..please give me any suggestion