Visual C++ :: How To Use 2 Command In System Function
Feb 7, 2013
I want to run Unhidden.exe in drive N: and send char to that program. I use function like this
Code:
system("N:/Unhidden.exe");
It can open Unhidden.exe but it run in visual studio 2010Projects . I try to use command N: and Unhidden.exe in cmd it can run in drive N: . So I try to use function like this
system("N:");
system("Unhidden.exe");
but it not found Unhidden.exe . How to use 2 command in sytem() function ?
I'm writing a program to turn the two commands "gunzip file.tar.gz" then "tar -xvf file.tar" into "x file.tar.gz", but I've ran into a problem I can't find a solution to, here are the outputs I get depending on if I use a gunzip -f flag in my system() call or not:
if I use: (void)system("gunzip ", store ); > x file.tar.gz gzip: compressed data not read from a terminal. Use -f to force decompression. type: gzip -h store 1: file.tar.gz tar: option requires an argument -- 'f'
[code]....
I don't know if the problem is something to do with my code or something to do with gunzip and if it is to do with gunzip if I can even solve it with my code? I've tried for a while to find more info and read the gunzip man file, ran "gunzip file.tar.gz" outside of my program and found that it works normally producing file.tar so I suspect the problem is related to system()?
So using InitiateSystemShutdownEx causes a Win32 machine to go log off go to the shutdown screen and just sit there displaying shutting down with the working indicator just spinning. I left the machine sitting there for an hour and it never shut down. This works fine on all the Win7 x64 machines we are using but the one 32 bit Win7 machine has this problem and it occurs no matter what parameters I pass.
Code: HANDLE hToken; TOKEN_PRIVILEGES tkp; // Get a token for this process. if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) return false ; // Get the LUID for the shutdown privilege. LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
[code]....
This is working fine on Win7 x64 but not on the one Win7 32 system we have and like I said it starts the shutdown process just never finishes.
I have created a MFC dialog based application. Now I want to implement such a functionailty that I will be closing my application through command prompt. And while closing of my application the ExitInstance() method of my application should get called. What is the command which I should put in the command prompt to close my application in such a way.
/** Add a feature to a (mutable) LV2 feature array. */ static inline void suil_add_feature(LV2_Feature*** features, unsigned* n, const char* uri, void* data) { for (unsigned i = 0; i < *n && (*features)[i]; ++i) { if (!strcmp((*features)[i]->URI, uri)) {
[Code] ....
suil_add_feature is used to add features to an existing array of pointers to type LV2_Feature. Initially, the array gets searched to see if the feature already exists. If it doesn't, the existing array gets increased by one element which then gets initialized to the new LV2_Feature value. Resizing is done using realloc()
I'm having a problem when I build a Debug version. The first 5 times I call suil_add_feature() realloc() ends up calling _realloc_dbg() (in dbgheap.c) and everything works fine. But on the sixth call, realloc() calls _realloc_base() (in realloc.c) which brings everything crashing down. I assume that _realloc_base() is intended for the normal (non-debug heap). So this particular app is somehow linking to both the debug and non-debug runtime modules.
If I was building using the VS IDE I could probably figure this out - but although my compiler is MSVC, my build environment is waf, which I'm a bit unfamiliar with. I'm guessing I need to add some lines to my waf script to let it know that it shuld ignore the non-debug runtime libraries when building a Debug version.
Can I achieve this by adding /NODEFAULTLIB to the linker options or is it more complicated than that?
I need to list out all the shared folders(directory) in the system along with their path . i want a command or an api in MFC, for listing out the shared directories.
I want to read sentence from command line. I open some program which run in command line and I have to wait for that program process. So , I don't know when process success .I can't type next command if can't read sentence from command. I use
Code: wprintf(GetCommandLine());
but it show
"C:UsersPKRUdocumentsvisual studio 2010ProjectsVirus ScanDebugMyProgram
I am drawing in a simple (square) MFC window. I realize that (0,0) starts in the upper left hand corner. I wanted to see how MFC handled drawing of angles, so I use this code:
Code: double CompassDegreesToRadians(double compassDegrees) { return((PI / 2.0f) - (compassDegrees * PI / 180.0f)); } // Make pen CPen penRed; penRed.CreatePen(PS_SOLID | PS_COSMETIC, 1, RGB(255, 0, 0)); // Test Angles
[Code] .....
Using this code, and changing the value of angle1 to these values (0, 90, 180, 270) I think MFC uses the coordinate system:
This seems like a strange coordinate system to use. Am I doing something wrong? If this is correct, how can I convert my calculations to this coordinate system? (compass degrees):
I am struggling to find a replacement of NtQuerySystemInformation call for 64-bit Windows OS, like on Windows Server 2008 (64-bit). Need getting overall CPU utilization (average) over all CPU cores?
I am facing a problem in C++,I want to execute a command in Command prompt from a specific path.I am able o select a path and execute cmd.exe using the function ShellExecute but the problem is after selecting the path I am not able to execute the command, the command is appearing on another command prompt.
I am getting "driver could not be loaded due to system error 8" error while connecting to SQL Server 2005 from VC++. Its also throwing out of memory error. Basically i am developing and ISAPI dll. I use the following code to connect to DB.
I need make a CBitmap or a streamdata from a System.Windows.Controls::Image(rendered out put)in a SDI mfc application (supporting clr). Here is my codes:
Code: using namespace System; using namespace System::IO; using namespace System::Collections::Generic; using namespace System::Windows; using namespace System::Windows::Controls;
[Code] .....
By this codes i can read datastream from bitmapSource but in this way somthing goes wrong in most of GIF animations. After debug i found out i need 3 more things too decode a gif animation - (x,y) position and size of each frame and disposal method for each one - finally i just found a way to draw tru images on a form window by this codes:
Code: bitmapSource = decoder->Frames[0]; to Code: bitmapSource = decoder->Frames[01];
frame[1] has drawn perfectly on window(i think some how Image class takes care about - (x,y) position and size of each frame and disposal method for each one ),so im wonder if how can i make a CBitmap or a data stream from System.Windows.Controls::Image class to use in mfc app.
I have had experience in programming from python (slightly related, html/css) and the computercraft from minecraff (basic i think it is).
My question is mainly about the C and past experience with the computercraft.
1. Is it possible to split the command console into 2 parts (a visual area and a text area) 2. Is it possible to use any form of pixel art or custom characters within any command console using C.
Actually the below program is for Dispersal Algorithm called Rabin-IDA; this algorithm divided the data into N pieces and then recombine it from M pieces (such that M<N).
Thus, the below program needs command line arguments,which entering by Project properties/Debugging. this argument is file name, where the program performing spitted the file into N files, and then recombine it from M divided files, and put it on another file which should also passing its name as argument .
Now my question is, How can i make this program enter the file name by keyboard??(i mean enter the files name by user from screen not as command line arguments) ... In another word, How I can exchange ?
Code: argc == 3 and Code: argc == 2
To enter file name ? i mean what i should do to in
Code: rabin.split(argv[1])
To pass my file name by use keyboard not Project properties/Debugging?)
the below code is just the main function of program, and the whole of it in this link [URL] .... Information Dispersal Algorithms Rabin-IDA.
I know there has to be a system call for a pause function. I simply want the program to pause for a few seconds before executing the next line of code. I do NOT want the user to enter a keypress, just pause the output or code execution for a few seconds.
system (pause); waits for keypress right? I just want it to wait 3 seconds before proceeding. I know it should take an argument for milliseconds right? Also, this is for a homework assignment I have already completed, just doll'in it up a bit for extra credit...maybe...
I am using the gnu glpk library to calculate a linear program for my matrices. Why I get the error message exit code 3 which apparently means "The system cannot find the path specified"?
I am making an application that processes multiple files (typically > 500) through a command prompt call. The way I start the command prompt app is by looping using a call to CreateProcess for each file that is to be processed. It works fine, except that I somehow loose 'connection' to my app so that
1: Windows says that the app. is 'Not Responding' 2: The Cprogress bar in my app is not updated before all files have been processed, even though there is a CreateProcess call and a Cprogress.StepIt() from the app for each file that needs processing.
I somehow suspect that the CPU gets swamped... I do not want that Windows starts to say that my app is 'not responding' and I want my Cprogress dialog bar to update according to the number of files that are progressed through.
I wonder if multithreading is the OK way to go instead of just kicking of series of CreateProcess calls? Maybe my CreateProcess is not ending correctly? It seems as if my app is 'not regaining control' before very late. The app never crashes though.
My CreateProcess code is listed below, maybe there can be a problem with it, or maybe I should do things in a different way? My app basicaly works as it never crashes, but with above mentioned problems it is NOT a pro solution...
void CMultiFilerDlg::ProcessFile(CString pdfFile) { int i=0; DWORD ProcID; // Open file in text mode: STARTUPINFO si; PROCESS_INFORMATION pi; char cmdArgs[2052];
In class, we have learned how to set up the main method so we can convert command line arguments to integers and utilize them. Here is an example of a method we learned to store command line arguments as integers in an array:
Code: int main (int argc, constchar* argv[]) {int i; int a[argc - 1]; // Fill the array with the arguments on the command line for (i = 0; i < argc - 1; i++){ a[i] = atoi(argv[i + 1]);
[Code] .....
I understand that there are probably better ways to do it than using the atoi function, but for our purposes, the professor said this was okay.
Now, I am being asked to create a separate function to perform the same task (store integers in an array). I was told I would need to declare the array "out in the main program", and that the function would need to take at least 2 arguments: an array, and an array size.
Firstly, what should my return value be? My professor gave a hint that it would be important for me to figure out what the return value is, but I don't see why it would be anything else than void.
Also, wouldn't I need a third parameter? Perhaps the integers that are being stored in the array? (But how would I represent this as a parameter)?
I have a problem: solve the system of equations by the Gauss-Jordan methods with pthreads. I have a big matrix A (for example 2000x2000), so i must solve Ax = b. Before I devide matrix to number of threads and each thread must work only with his peace of matrix.
Code: #include <iostream> #include "synchronize.h" #include <pthread.h> using namespace std; typedef struct _ARGS { int thread_count; int thread_number;
[Code] .....
I write it on Ubuntu, and when I compile [g++ main.cpp -o main -lpthread -lm] the it works good(for example, if in 1 thread I get time_of_working = 10 sec, on 2 threads time_of_working = 5.4, i.e. about 2 times faster ), if I compile like this [g++ main.cpp -o main -lpthread -lm -O3] it is only 1.2-1.3 times faster.
I have to write a function for the destruction of the planetary system "solid". With the destruction of the planetary system, the asteroids where the gap between this one and the object, is smaller that "gap" will also be destructed. (so, they have to be deleted) The asteroids for which the gap is greater are converted to free-floating planets so they have to be inserted into the tree of free-floating planets. The total cost of the transport of all the asteroids that are converted into free-floating planets in the tree of free-floating planets should be $O(n)$, where $n$ is the maximal between the elements of the tree of free-floating planets of the star system to which the object belongs and the elements of the tree of asteroids of the planetary system of which the object has identifier "solid". The field "gap" of the new tree should have the value $0$. The destructed planetary system should be deleted from the list of planetary systems of the star system to which it belonged. (The tree of free-floating planets is not a binary search tree)