How to assign a string to a char array without stdc++.h?

Viewed 75

How to assign a string to a char array without stdc++.h?

The purpose of this program is to copy the program to the destination c:\users\yourusername

#include <ansi_c.h>
#include <windows.h>


int main(void)
{
String windoesuser="c:\\user"+ useename of windows;
  char filename[ MAX_PATH ];
  char newLocation[]=string windowsuser;//put actual path here (i.e. don't use as is)
  BOOL stats=0;
  DWORD size = GetModuleFileNameA( NULL, filename, MAX_PATH );
  if (size)
    CopyFile(filename, newLocation, stats);
  else
   printf("Could not find EXE file name.\n");
  return 0;
}

Orginal code is here

#include <ansi_c.h>
#include <windows.h>


int main(void)
{
  char filename[ MAX_PATH ];
  char newLocation[]="C:\\enterstartupdirhere";//put actual path here (i.e. don't use as is)
  BOOL stats=0;
  DWORD size = GetModuleFileNameA( NULL, filename, MAX_PATH );
  if (size)
    CopyFile(filename, newLocation, stats);
  else
   printf("Could not find EXE file name.\n");
  return 0;
}
0 Answers
Related