Click here to Skip to main content
15,877,637 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to pass xterm -e option as variable? Pin
jschell1-Jan-24 2:07
jschell1-Jan-24 2:07 
GeneralMessage Closed Pin
1-Jan-24 9:51
Salvatore Terress1-Jan-24 9:51 
GeneralRe: How to pass xterm -e option as variable? Pin
k50541-Jan-24 13:09
mvek50541-Jan-24 13:09 
GeneralRe: How to pass xterm -e option as variable? Pin
jschell2-Jan-24 6:14
jschell2-Jan-24 6:14 
GeneralRe: How to pass xterm -e option as variable? Pin
Richard MacCutchan1-Jan-24 22:13
mveRichard MacCutchan1-Jan-24 22:13 
GeneralRe: How to pass xterm -e option as variable? Pin
jschell2-Jan-24 6:26
jschell2-Jan-24 6:26 
AnswerRe: Please - explain the C++ code / function Pin
Richard MacCutchan28-Dec-23 22:02
mveRichard MacCutchan28-Dec-23 22:02 
AnswerRe: Please - explain the C++ code / function Pin
jschell29-Dec-23 5:16
jschell29-Dec-23 5:16 
Salvatore Terress wrote:
it fails.


Do not post questions with information like that. That can mean anything. What you need to post is the following.
1. What you expected it to do.
2. What it actually did.

From the little you posted I would have no idea what 'fails' means.

Salvatore Terress wrote:
sudo


I suspect the real problem is exactly that.

It is not your code. It is how that gets executed within your code.

Define: A 'shell' is a operating system process that executes command line commands. Windows has the console window and powershell.

First step for debugging OS shell calls is always the print the command line before you call it. (Obviously removing security info if needed.) You do that even when the code works.

Then when there is a problem you use that output to figure out what is wrong.

Second step is to try the exact command in your own shell window. Often this will show the problem and allow you to figure out exactly how you need to modify the command.

Third step is that you need to understand that OS commands that are executed from your application can and problem will have an environment that is inherited from the application. This includes access permissions. (People often have problems with Windows Services because they do not understand this.)

Finally I can only note that with my limited experience I know that 'sudo' has its own oddities. For one, at least at times, I remember it requiring a password all the time. No password and it doesn't work.

Another trick I have used for OS commands in an application is the following.
1. Output the command - as I said above you should always be doing this.
2. Use an OS command to open a shell - NOTHING else. So you would see a OS shell pop on your display
3. Copy the command from the output, exactly as printed, and then run it in the shell that was popped.
4. Debug as normal for problems with that command.

That trick often helps to simulate the environment problem I suggested above.
AnswerRe: Please - explain the C++ code / function Pin
jeron112-Jan-24 5:04
jeron112-Jan-24 5:04 
GeneralRe: Please - explain the C++ code / function Pin
Richard MacCutchan12-Jan-24 5:39
mveRichard MacCutchan12-Jan-24 5:39 
GeneralRe: Please - explain the C++ code / function Pin
jeron112-Jan-24 6:16
jeron112-Jan-24 6:16 
Questiondeleting from a vector Pin
mike741124-Dec-23 20:37
mike741124-Dec-23 20:37 
AnswerRe: deleting from a vector Pin
Richard MacCutchan24-Dec-23 21:39
mveRichard MacCutchan24-Dec-23 21:39 
AnswerRe: deleting from a vector Pin
Mircea Neacsu25-Dec-23 2:19
Mircea Neacsu25-Dec-23 2:19 
Questionstd::async Pin
utcode23-Dec-23 16:31
utcode23-Dec-23 16:31 
AnswerRe: std::async Pin
Richard MacCutchan23-Dec-23 21:32
mveRichard MacCutchan23-Dec-23 21:32 
Questiondesign question : variadic functions use ? . Pin
Maximilien19-Dec-23 2:34
Maximilien19-Dec-23 2:34 
AnswerRe: design question : variadic functions use ? . Pin
Mircea Neacsu19-Dec-23 2:42
Mircea Neacsu19-Dec-23 2:42 
GeneralRe: design question : variadic functions use ? . Pin
Maximilien19-Dec-23 2:54
Maximilien19-Dec-23 2:54 
AnswerRe: design question : variadic functions use ? . Pin
jschell19-Dec-23 5:08
jschell19-Dec-23 5:08 
GeneralRe: design question : variadic functions use ? . Pin
Maximilien19-Dec-23 7:36
Maximilien19-Dec-23 7:36 
GeneralRe: design question : variadic functions use ? . Pin
jschell20-Dec-23 5:31
jschell20-Dec-23 5:31 
GeneralRe: design question : variadic functions use ? . Pin
Maximilien20-Dec-23 6:55
Maximilien20-Dec-23 6:55 
GeneralRe: design question : variadic functions use ? . Pin
jschell21-Dec-23 3:31
jschell21-Dec-23 3:31 
Questionstrcpy_s weirdness Pin
mike741119-Dec-23 1:31
mike741119-Dec-23 1:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.