Hello! I need help with my system() function so I can add arguments. Here is my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include "stdafx.h"
#include "windows.h"
#include <stdlib.h>
int _tmain(int argc, _TCHAR* argv[])
{
char name[255]={0};
char pass[255]={0};
printf("What is your computers name: ");
scanf("%s", name);
system("CLS");
printf("What do you want the password to be: ");
scanf("%s", pass);
system("CLS");
system("net user %s %s", name, pass);
return 0;
}
The system() function has an error saying: Unhandled exception at 0x598b29fe (msvcr100d.dll) in WindowsPassChanger.exe: 0xC0000005: Access violation writing location 0x00f35754.
If you really want to do it that way, use sprintf() to put variables into a string, then send that string to system(). You can't assume the function works like printf().