Parameters for external call

2

I use Linux and by default (or at least in my case) it does not have screen brightness control, however it has a program that can control it.

The question here is that I want to get the value of the "user" and use this value in a function type: system("sudo light - Valor que receber aqui"); , to get the value and use in the function with C ++?

What I've done so far (I'm implementing things I use daily): ideone.com/QFHA6c

    
asked by anonymous 19.11.2016 / 03:57

2 answers

3

I consider this a gambiarra. Not that it can not be done, but you'd rather do code yourself. You have a question about this in the OS that might help. You have one more related there .

If you want to insist:

printf("system returnou %d", WEXITSTATUS(system("sudo light")));
    
19.11.2016 / 12:04
1

Give yes ; just call the function and save the return message. After that, in a new variable, edit the string that goes in system(); (in this case, it will treat it as a String variable or a simple C string itself). Just play within system(); !

When I say edit the string .. I think a lot about C and the functions of string.h . In C ++ it's easier, since there is a String type.

    
19.11.2016 / 04:34