Whenever I run the code below (Yes that's all the code) the compiler gives me an error:
error: initializer fails to determine size of ‘path’
What I want to do is copy the contents of argv[0], which is the path of the application as a character array, into the path variable.
int main(int argc, char** argv) {
    int offset = 0;
    int pathSize = 0;
    while(argv[0][pathSize] != '\0')
        pathSize++;
    char path[] = new char[pathSize];
    delete &path;
    return 0;
}
                Your error is in the below part of your code:
char path[] = new char[pathSize];
delete &path;
Change it to...
char *path = new char[pathSize];
delete[] path;
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With