I need to do an equivalent of kill -11 <pid>(which is in unix) in windows.
I need to crash a process with SEGV so that it would dump core in windows. Is there any tool by which we can do this . Also is there any sample code through which we can achieve this .
In windows we have taskill which only terminates a process , but is unable to send a signal like SEGV to the process upon which it would terminate and dump core .
I'm wondering whether it's possible to implement MPI to execute a process in parallel from deep within a C++ solution.
I've created a solution on VS2005 that links to several static libraries, and within one of these libraries there is a set series of tasks that require execution many times - they're independent so I'd like them to execute them using MPI if possible to speed up the run time.
The pseudo-code is:
Code: for(i = 0; i < n; i++) // n is number of times to execute process { PerformTask(data[i]); // perform the tasks required for each iteration of process }
So, instead of conducting the tasks within PerformTask() in series n times, I want to split the array data between multiple processes such that they can each be allocated an even proportion of data to perform the tasks on. Pretty textbook reason for wanting MPI, right?
Now, I've read up and understood the basics of MPI implementation, but all the examples I've seen are called within the main() function of the program. But I need to do all this from within a static library, is this possible?
I've made some early attempts at implementing this, but get an error indicating the process wasn't initialised: "Error encounted before initializing MPICH", which I assumed would be due to trying to make the MPI calls outside of the main() function.
Code: Program received signal SIGSEGV, Segmentation fault. isoc99_fscanf (stream=0x0, format=0x4014e0 "%u %u %u %u") at isoc99_fscanf.c:30 30 isoc99_fscanf.c: No such file or directory. Code:
I'm new to C++ and am trying to create a program to solve the problem as described in this image: [URL] .....
Here's my code. It fails to execute the main part of the problem (years, population of A & B) but works well in recognizing errors (if PopA >PopB or if growth rate of PopA<PopB)
Code: #include <iostream> #include <iomanip> #include <string> using namespace std; int main() { string city1, city2;
System();is bad, I get that. Is there another way, that works across platforms I can use to execute an external program. If not, is there a windows specific way.
1. Read FILE.INP as input file and run its code execution. 2. When finish, RUN.EXE will produce FILE.OUT as the output of its code execution. 3. However, if calculation made in the code execution come to unsatisfied condition, RUN.EXE will terminate without producing FILE.OUT or partially produce FILE.OUT.
I want to write a program using MFC which I can set a several input case. The program should be able to:
1. Call RUN.EXE. 2. Wait for RUN.EXE to exit. 3. Continue with other code.
I can't modified RUN.EXE. I can't have RUN.EXE callback my program to let know it finish its work.
Are there any functions to call RUN.EXE, a MS-DOS program? Are there any way for the program to check if RUN.EXE finish its work and exited?
The problem is with the first "Type and Run," where the code looks like this:
Code: /* print_it.c--This program prints a listing with line numbers! */ #include <stdlib.h> #include <stdio.h>
void do_heading(char *filename); int line = 0, page = 0;
[Code] ....
I am using the gcc compiler in Ubuntu 12.04 LTS and I get the following error:
Code: print_it.c: In function "main": print_it.c:36:15: error: "stdprn" undeclared (first use in this function) print_it.c:36:15: note: each undeclared identifier is reported only once for each function it appears in print_it.c: In function "do_heading": print_it.c:49:16: error: "stdprn" undeclared (first use in this function)
I was told that "stdprn" can be recognised by a DOS based compiler and the book says I can try using "stdout" instead. It looks like this now:
Code: /* print_it.c--This program prints a listing with line numbers! */ #include <stdlib.h> #include <stdio.h>
void do_heading(char *filename); int line = 0, page = 0;
[Code] .....
It compiled OK with the gcc compiler but I only get this when I run the program:
Code: Proper Usage is: print_it filename.ext
I am not sure whether I should continue looking into this but even when I tried compiling and running it on Windows, the .exe file won't even launch. The other ones do but this first one doesn't.
Questions:
1. What should be done to make this program run? 2. Even though the book says "don't care" if the reader does not understand the items (It's Day 1/Lesson 1), I would still like it to run as I don't want to experience compiling and running problems in the future. Should I even bother doing this section of the book or is it obsolete and should be skipped?
Suppose I have a txt file that I want the contents printed to the console in such a way that every five words are colored blue and the following five are red. How do I accomplish such a task? I am currently only able to print the contents of the file in regular color using ifstream.
write a program as described below: program that reads in two integers (age, social security number). You should write functions that throw an out-of-range exception forage (no negative numbers)SSN (must be a 9-digit integer) My code is written below:
#include "std_lib_facilities_4.h" int main(){ int age = 0; int ssn = 0;
writing a program that requires exception handling. if an error occurs, i what the program to go back to the begging of the loop. i tried using break but that just makes the program crash when it receives a bad input. how do i do this? this is what i have so far (this part of the program any ways)
while (! quit) { // Output phone book menu cout << endl
I'm trying to make a Quiz program based on C++'s Data File Handling capablities. I've attached the code in .txt file and I wonder why I'm getting the error identifier bScience cannot have a type qualifier?
I want to write RPC program in C for matrix multiplication - My question is that during serialization & deserialization process ,what shall I keep in mind? I recently got an error "call failed: RPC: Can't decode result " ,what this means?
My program is simply send an array A and return 3*A.
I have a program that I can only run one instance of. When I try to start it a second time, it doesn't do anything. I would like to create a script that loads the program in a way that I can run multiple instances. Since I assume the program checks the process tree on startup to see if an other instance is already running, I figure disabling access to the process tree could do the trick.
1. I want to do 2 while at the same moment. Exactly I want one while which is checking the time and it should di something every X second and the other should check something parallel.
2. How i can write the program what i write automaticly into the autorun on every windows pc.
3. Can i change the process-name when the programm started?
4. Can i save my .exe under another name in the autorun
How to incorporate exception handling code into my existing calcMortgage code. While I was researching exception handling, I thought "what would happen with my current code if someone input the principal with a comma in it?". Typically people write two hundred thousand like so.... 200,000. While experimenting with my original code, I remembered reading in my research that someone had done their calcMortgage with the output prompt "DO NOT USE COMMAS". So, when checking to see if my code would run, I did not use commas.
Well, guess what...using a comma in the principal causes an error with a negative numerical output. lol PERFECT!!!! Obviously, the easy thing to do would be to put output instructions in the code telling the user NOT to use commas, but the assignment requires me to use exception handling. The code itself works, but the calculation produces a negative monthly payment.
How would I insert exception handling code into my current code to correct this problem??
#include <iostream> #include <cstdlib> #include <cmath> using namespace std; struct calcMortgage { double Principal, numYears, IntRate, monthlyPayments;}; int main(){
What I have: A basic program for infinitely looping after and testing for an active process. It has a delay system built in to make it so it is not constantly iterating.
What I need: A way to get process IDs from other Processes other than my program. With a way to use that ID to detect if that process is active on the computer or not.
Parts of my code that need changing:
/* Code for handling the process would go here */
/* Code for detecting the target would go here */
What the goal of my program is: Perform operations to terminate the process of cmd.exe when it is active on the user's computer. Then output the status of the process and the time it took to find that process to the user.
It contained functions that I needed, but I need more information on how to apply them to other processes instead of the parent of my program and its' children.
The brief is to write a program that implements a musically-interesting or musically-useful audio effect/process in C without external libraries other than those prescribed (PortMedia/PortMIDI/PortSMF/PortAudio, Libsndfile).
Since the signal function is also in file signal.h and I included it in "my_sygnal.h" file, I'm wondering why the compiler did not say anything about this "double declaration" of the function with the same name.
int i; while (scanf("%i", &i)) printf("%i ", i); printf(" done ");
i tried several combination of Ctrl+D and "Enter", it's not terminating, Ctrl+C just "cancels" the whole thing without printing "done", i'm running this on linux installed on a PC
This can be done very easy, but I assume there is a better way to do it.
assume that I have a vector or a signal like
x=[1 1 1 1 1]
want to shift it by one unit to the right I have
x[n+1] gives
xn=[0 1 1 1 1 1]
and x[n-1] vies
xn=[1 1 1 1 0]
as you can see the length of the original vector or array does not change.
How can I solve this problem without specify the length of the output vector. The size of the output array should be the same as the input array, but I couldn't find a way to do it without adjusting the size.
I need to set signal handler for my process. As the signal is related with the process on system level I have faced the problem. My program consists several classes. They are connected together. But it doesn't metter in this case. The problem is that I need to access to member and methods of the class from my signal handler. For instance , I have class named Foo at it has some members and methods.
So from my handler I need to call its function and change members. I understand that compiler should know that this class instances will exist during all program execution. I have tried to set static member class Foo instance in another class , but this didn't solve the problem. How to correctly implement signal handling in such case.
Here is example of my code
class MyContainer { private: std::vector<Foo> container; public: int removeFromContainer(Foo* aFoo) {