I'm trying to open a file to read its content, but when it has spaces in its name (like lot of spaces.txt
), it doesn't even open it. How can I do that? I searched on the internet but only found the backslash \
solution (add a backslash before every space [like lot\ of\ spaces.txt
]), that doesn't works to me.
MyFileCompressor.c
int main()
{
char directory[100];
char * direct;
printf("File: ");
scanf("%s", directory);
if((direct = malloc(strlen(diretorio)+strlen(".newextension")+1)) != NULL)
{
direct[0] = '\0';
strcat(direct, directory);
strcat(directory,".newextension");
}
else
{
printf("Error!\n\n");
return;
}
compress_file(directory, direct); //compress the file in typed directory to the new directory (direct)
return 0;
}