How can I use multiple quotation marks in the system() function?

1.2k views Asked by At

I'm using:

char s[20]=system("vcgencmd | egrep "[0-9.]{4,}" -o");

The system() function has problems with the the number of quotation marks.

1

There are 1 answers

1
A.W. On

If your intent is to have a traditional C-style string that contains double quotation characters, then you can just restructure your expression to be the following:

 char s[20] = system("vcgencmd | egrep \"[0-9.]{4,}\" -o");

In this case, each double quotation mark that appears inside the string is denoted by \"

the \ character is called an Escape Character.