I am using some existing code that someone else has written, and I cannot get it to compile (limited C experience here but I am trying to learn!).
utilities.
Try this instead
char *filename1 = new char[filenameLength];
you cannot create an array as a local variable length array on the stack like this
char filename1[filenamelength];
unless filenamelength
is declared as const
.
Also as you have allocated memory for an array, you should free the memory using
delete [] filename1;
otherwise you will have a memory leak. Also it is not essential to have parentheses around your return
values;