how to implement calloc, malloc and free. At the end of my program, I keep getting a "windows has triggered a break point" error. Im pretty sure that this error is happening because of the way I am implementing free because this is the error I am getting in free.c - " retval = HeapFree(_crtheap, 0, pBlock);".here is the code which I allocate and free memory:
Code:
int main (){ WORDS userWords[16]; char **board; int i=0, n=0, numWords=0; srand(time(NULL)); numWords = enterWords(userWords); }
Is it possible to write a program such that it will automatically execute the function in queue base on their priority even if user programmed it randomly?
Code:
function1(){ very_important; } function2(){ important; } function3(){ less_important; } int main() { // Programmed by user function3; function1; function2; //Output: Program will execute function1, 2 and lastly 3. }
I have simple LCd_call function . I am calling this function from main . I wanted to call this function once. problem i am facing here, When lcd_call function being called. It enter the cases but instead of staying paricular case it coming back and starting case 1 iteslf . for every 6s it change the case to 1:
I would like to implements something in my code that clears the value of my variables when the user closes the console. How to do that or the program clears the values automatically?
That this will execute those binary instructions in hexadecimal notation BUT WHY? I don't get why that works since that's an array of data not a function?
i need to create an small windows form, with some buttons, and then those buttons will "exectute" an action on a remote webserver.
Im searching with http requestings and didn't find nothing useful for what i need.
The basic thing is that i just need to press "EXECUTE" and then c# will press one link in the Webserver. I do not need any feedback from the page. I just need that C# execute a link like localhost/startbackup.php then the actions from the startbackup.php will run.
I do not need any information regarding if the page was successful executed or not, or even if it opens one window. Nothing.
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.
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;
I'm working on a project that's got a lot of moving parts, from feedback from a position sensor to real-time video editing. The script that runs the sensor is in C++, and the API for the video editing software (vMIX) is executed with HTTP protocol. I'm hoping to use that C++ script to control the video software (as some of the editing is dependent on particular feedback from the sensor), and wanted to see how to execute a HTTP command from a C++ script.
I'm trying to create a program that will show what the 12th digit of a UPC code would be. However, once the user enters the first 11 digits the program doesn't execute the last call of printf. The program compiles with no issues.
Code:
#include<stdio.h> int main() { int o1, e2, o3, e4, o5, e6, o7, e8, o9, e10, o11, oddsum, evensum, twelve; printf
Im going through a C tutorial and im going to create a Database as part of the course. Im just in the very beginning of the project so its a very simple program so far.
Code:
#include<stdio.h> main(){ /*Variabler for att lagra information om skiva*/ char title[200]; char artist[100]; int tracks; int price;
[Code] ....
The first switch case statement takes me to the menu of choice, 1 or 2. However, chosing menu option one and trying to input a title or artist name, the program crashes.
Next, going into menu option 2 and then trying to print out, for example, title nothing happend. The process just ends.
Again, im sure this simple prototype is full of errors ....
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.
void Arrival_MainThread::Body () { t1 = new boost::thread((Arrive_Fctor()), 2); t2 = new boost::thread((Arrive_Fctor()), 10000); t3 = new boost::thread((Arrive_Fctor()), 3000);
Code: class Arrive_Fctor { public: void operator()(int mean) { m_Arrivals = new Arrivals(mean); m_Arrivals->Activate(); #ifndef NO_RESOURCE
[code].....
The order of arrivals always appear as 3,2,1 it can't be 1,2,3 or 3,1,2 or something like that?
The body method is called when m_Arrival->Activate() is executed, and it is running as an independent thread.
I'm working on a Hash Table implementation and after fixing all the errors and finally getting it to compile and link correctly, I am met with a black screen upon execute.
main.cpp #include <stdio.h> #include <string.h>
[Code]....
I tried inserting a debug statement in the main() function to see, and it wouldn't even print out the message "debug me" on the screen.
I am using Code::Blocks on Windows with the mingw32-g++.exe compiler. Here is my build log:
I have to write a C++ program that picks a random number between 0 and 49. If the number is even lets say 30, then the computer will display 30, 32, 34, 36... all the way till 100, if its odd lets say 17, then the computer will display 17, 19.. till 99. I got the computer picking a random number, I just can't figure out how to display every other number using a for loop statement. Here's my code for random number generator:
#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main()
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?