digitalmars.D.learn - system() without window
- okibi (3/3) Jul 11 2007 Hey,
- Regan Heath (5/10) Jul 11 2007 I doubt it.. but you can call CreateProcess and prevent the window
- okibi (3/15) Jul 11 2007 Is there documentation somewhere on how these work? Also, will they work...
- Regan Heath (16/34) Jul 11 2007 Popen;
- okibi (9/51) Jul 11 2007 I tried your method for popen and i get "Symbol undefined" errors. I als...
- Regan Heath (7/18) Jul 11 2007 Ahh, I was mistaken; popen only works on UNIX. You need to code up
- okibi (3/25) Jul 11 2007 Does system() (within std.process) not work on linux? I was under the im...
- okibi (9/51) Jul 11 2007 I tried your method for popen and i get "Symbol undefined" errors. I als...
Hey, Is it possible to run a command with the system() function without having the program open up a command prompt until it finishes? Thanks!
Jul 11 2007
okibi wrote:Hey, Is it possible to run a command with the system() function without having the program open up a command prompt until it finishes? Thanks!I doubt it.. but you can call CreateProcess and prevent the window appearing. Also there is popen which may prevent it. Both are more complicated than system but offer more flexibility too. Regan
Jul 11 2007
Is there documentation somewhere on how these work? Also, will they work on both Windows and Linux? Thanks! Regan Heath Wrote:okibi wrote:Hey, Is it possible to run a command with the system() function without having the program open up a command prompt until it finishes? Thanks!I doubt it.. but you can call CreateProcess and prevent the window appearing. Also there is popen which may prevent it. Both are more complicated than system but offer more flexibility too. Regan
Jul 11 2007
okibi wrote:Is there documentation somewhere on how these work? Also, will they work on both Windows and Linux? Thanks! Regan Heath Wrote:Popen; http://www.opengroup.org/pubs/online/7908799/xsh/popen.html You will need to do something like: extern(C) FILE *popen(const char *command, const char *mode); in your D source file before you can call it. See dm\include\stdio.h for the function declaration. Any function you can find in the dm include directories can be called like this. I wrote a ProcessStream using CreateProcess etc which worked on both windows and linux (although there may have been a few bugs to deal with): http://www.digitalmars.com/d/archives/digitalmars/D/learn/internal_error_toObjFile_7911.html You can find stuff like this by searching the archives here: http://www.digitalmars.com/d/archives/digitalmars/D/index.html http://www.digitalmars.com/d/archives/digitalmars/D/learn/index.html ..etc.. Reganokibi wrote:Hey, Is it possible to run a command with the system() function without having the program open up a command prompt until it finishes? Thanks!I doubt it.. but you can call CreateProcess and prevent the window appearing. Also there is popen which may prevent it. Both are more complicated than system but offer more flexibility too. Regan
Jul 11 2007
I tried your method for popen and i get "Symbol undefined" errors. I also tried this code: extern (C) { typedef void FILE; FILE* popen(char* cmd, char* type); int pclose(FILE* stream); } and get the same errors. Any ideas? Regan Heath Wrote:okibi wrote:Is there documentation somewhere on how these work? Also, will they work on both Windows and Linux? Thanks! Regan Heath Wrote:Popen; http://www.opengroup.org/pubs/online/7908799/xsh/popen.html You will need to do something like: extern(C) FILE *popen(const char *command, const char *mode); in your D source file before you can call it. See dm\include\stdio.h for the function declaration. Any function you can find in the dm include directories can be called like this. I wrote a ProcessStream using CreateProcess etc which worked on both windows and linux (although there may have been a few bugs to deal with): http://www.digitalmars.com/d/archives/digitalmars/D/learn/internal_error_toObjFile_7911.html You can find stuff like this by searching the archives here: http://www.digitalmars.com/d/archives/digitalmars/D/index.html http://www.digitalmars.com/d/archives/digitalmars/D/learn/index.html ..etc.. Reganokibi wrote:Hey, Is it possible to run a command with the system() function without having the program open up a command prompt until it finishes? Thanks!I doubt it.. but you can call CreateProcess and prevent the window appearing. Also there is popen which may prevent it. Both are more complicated than system but offer more flexibility too. Regan
Jul 11 2007
okibi wrote:I tried your method for popen and i get "Symbol undefined" errors. I also tried this code: extern (C) { typedef void FILE; FILE* popen(char* cmd, char* type); int pclose(FILE* stream); } and get the same errors. Any ideas?Ahh, I was mistaken; popen only works on UNIX. You need to code up something with CreateProcess. I recall someone else posted a popen implementation for windows once.. http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=14470 Maybe that will help. Regan
Jul 11 2007
Does system() (within std.process) not work on linux? I was under the impression that it did. I'll look into that, thanks! Regan Heath Wrote:okibi wrote:I tried your method for popen and i get "Symbol undefined" errors. I also tried this code: extern (C) { typedef void FILE; FILE* popen(char* cmd, char* type); int pclose(FILE* stream); } and get the same errors. Any ideas?Ahh, I was mistaken; popen only works on UNIX. You need to code up something with CreateProcess. I recall someone else posted a popen implementation for windows once.. http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=14470 Maybe that will help. Regan
Jul 11 2007
I tried your method for popen and i get "Symbol undefined" errors. I also tried this code: extern (C) { typedef void FILE; FILE* popen(char* cmd, char* type); int pclose(FILE* stream); } and get the same errors. Any ideas? Regan Heath Wrote:okibi wrote:Is there documentation somewhere on how these work? Also, will they work on both Windows and Linux? Thanks! Regan Heath Wrote:Popen; http://www.opengroup.org/pubs/online/7908799/xsh/popen.html You will need to do something like: extern(C) FILE *popen(const char *command, const char *mode); in your D source file before you can call it. See dm\include\stdio.h for the function declaration. Any function you can find in the dm include directories can be called like this. I wrote a ProcessStream using CreateProcess etc which worked on both windows and linux (although there may have been a few bugs to deal with): http://www.digitalmars.com/d/archives/digitalmars/D/learn/internal_error_toObjFile_7911.html You can find stuff like this by searching the archives here: http://www.digitalmars.com/d/archives/digitalmars/D/index.html http://www.digitalmars.com/d/archives/digitalmars/D/learn/index.html ..etc.. Reganokibi wrote:Hey, Is it possible to run a command with the system() function without having the program open up a command prompt until it finishes? Thanks!I doubt it.. but you can call CreateProcess and prevent the window appearing. Also there is popen which may prevent it. Both are more complicated than system but offer more flexibility too. Regan
Jul 11 2007