gabesz
gabesz

Reputation: 133

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

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.

Upvotes: 0

Views: 1315

Answers (1)

A.W.
A.W.

Reputation: 186

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.

Upvotes: 2

Related Questions