Ok, this code creates a segmentation falult where the comments indicate, i've tried everything to fix it... BUt i can't, and i have no idea hpow to fix it. I've seen things about allocating memory for this, but i'm not sure how this works.
Code:
int main(int argc, char *argv[]) {
char *sFileName, // This is the name of the file to pass to gcc/g++
*sFileExt, // and its file extension
*sOutName, // This is the name of the output file for gcc/g++ (-o)
...
cout << "Makefile name: ";
cout << "DEBUG:: Breakpoint 1" << endl;
scanf("%s", &sOutName); // THIS IS [EDIT] NOT [\EDIT] WHERE THE SEGMENTATION FAULT IS
cout << "DEBUG:: Breakpoint 2" << endl;
sOutName = substr(sOutName, 0, (strchr(sOutName, '.')-sOutName)); // strip all extensions // THIS IS WHERE THE SEG. FAULT IS