Hello everyone,

This is (as far as I can recall) my first post here, so "Hello", and if I do something worthy of criticism, please go easy. :-p

I have two questions.

First, I'm trying to make a program that needs to be run as administrator. I've seen several programs, one example is MalwareBytes anti-malware, which has the microsoft shield icon added to the program icon, indicating that the program will be run as an administrator. I need to do something like that with my program, so that users do not need to right click and choose "Run As Administrator", and can instead just run it, and get the "Are you sure" (or whatever) prompt. From what I've read, the way to do this is using a manifest. The thing is, I haven't been able to find any information on how to attach a manifest to my program. I don't know if it makes a difference, but I'm using Dev-C++. I'm assuming that I'd make a resource file that somehow references the manifest, but I really have no idea.

Second, I need help with string modification. I need to copy the program that I am running, using the program that I'm running to the appropriate location. I tried using
Code:
CopyFile(GetCommandLine(), "C:\\whatever\\directory\\is\\destination\\filename.exe", TRUE)
, however, the issue is that GetCommandLine() returns the directory without the double back-slashed to compensate for the escape character, so CopyFile fails. What I need to do then, is find a way of adding the second backslash to the value that is returned from GetCommandLine().

This actually leads me to a sub-question which is not as important as the others, but here goes:
I tried using strtok() to split up the string that contained the directory and file name, at the backslashes. My plan was to split it up into all of the seperate parts and then to use strcat(? Think that's the one, either way to add strings), to put the strings back together with the double backslashes. Now this was just a test on a seperate random source file and is not the program I'm actually writing, but anyway, here's what I tried (which failed):
Code:
#include <stdio.h>
#include <string.h>
#include <windows.h>

FILE *fp;
int writefile(FILE *fname, char *wstring);

int main(int argc, char *argv[]){
    
    char *original = GetCommandLine();
    writefile(fp, original);
    char *tok[17];
    *tok[0] = strtok(original, "\\");
    int i = 1;
    while(*tok[i] != NULL){
              printf("%s\n", tok[i]);
              *tok[i] = strtok(NULL, "\\");
              i++;
    }
    //printf("%s\n", original);
    
    system("pause");
    
    return 0;
}

int writefile(FILE *fname, char *wstring){
    fp = fopen("tester.txt", "w");
    if(fp == NULL)
          printf("Error\n");
    fprintf(fp, "%s\n", wstring);
    fclose(fp);
}
What I was trying to do was make an array of pointers which would be strings returned by strtok(). For some reason this kept giving me compiler errors. Specifically this error:

C:\Documents and Settings\Owner\My Documents\Dev-C++\randomtemp.cpp invalid conversion from `char*' to `char'

I don't know if that matters, because I'm thinking there must be an easier way to do this which I hope someone here can help me with .

Anyways, that's all of my stupidity concentrated into one post, so if anyone can help me with this it would be super-amazingly appreciated. (Seriously)

Thanks in advance,
-Primux (slackwarefan)