Answer the question
In order to leave comments, you need to log in
How to write file path with spaces in system function in C?
#include
void main(){
system("gcc C:/Folder/My Folder/example.c" );
}
So - does not work.
If you remove the space from the folder name (MyFolder) - it works.
How can this be fixed?
Answer the question
In order to leave comments, you need to log in
Escape quotes.
The backslash is also escaped in the same way, if it is suddenly required.
Character escaping is a mechanism found in text-based languages and protocols. It serves to deprive symbols that are considered official and have a special meaning and declare them “just symbols”. We need double escaping: for the OS (a string with spaces is quoted) and for C (a slash before the quote).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question