C++ ::  program Is Crashing When Trying To Call

Sep 5, 2013

My program is crashing when I'm trying to call b = a. What has me confused is that when I call c = d = b, it all works fine.

I actually think I see it now that I posted this. In operator= I'm changing the size, but I'm not changing the size of the array that it's pointing to correct? I'm keeping it as 'p = new T[size]' rather than changing it to 'p = new T[x.size]' correct?

#include <iostream>
#include "Array.h
int main() {
std::cout << "creating Array< int > object a ...

[code]....

View 13 Replies


ADVERTISEMENT

C/C++ :: Program Crashing On A Function Call In Main?

May 5, 2014

i have this program I am working on and it seems to crash after the function call getdata()

here is the code

#include<iostream>
#include<string>
#include<cstdlib>

[Code].....

View 1 Replies View Related

C++ :: Program Crashing When Initialized

Oct 13, 2014

I just finished coding a program that is based on polymorphism and inheritance but when I ran the program it crashed? I do not know what is the cause of the program crashing.

#include<iostream>
#include<string>
using namespace std;
class Shape{
float density;

[code].....

View 9 Replies View Related

C :: Program Crashing When Deleting A Record

May 5, 2013

Code:

#include<stdio.h>
//bookData structure
struct bookData {
int recordNum;
char description[ 15 ];
int booksBought;
double bookCost;

[code]...

I am able to add records and show records, no problem. But when I go to delete a record, it crashes immediately after inputting the record number I want to delete. I don't see why. I've set it up exactly like the example in my book, having of course changed the variable names for my program. Does it have something to do with the pointer?

View 3 Replies View Related

C :: Program Seems To Be Crashing At Random Numbers

Mar 3, 2014

When I go to run the Fibonacci function ( fib ), it begins to return incorrect calculations towards the higher numbers, but then seems to correct itself for a little bit, but then does it again and ultimately crashes. And the program seems to be crashing at random numbers. Sometimes the it will make it up to F(55), other times it will only get to F(20).

Also, when I go to run the program on a Linux server, it segfaults, but it doesn't when I just run it on my IDE. the function adds two arrays with individual digits together. It does this to allow the program to add numbers that would exceed the boundaries of INT_MAX.

Here is the header file "Fibonacci.h":

Code:

#ifndef __FIBONACCI_H
#define __FIBONACCI_H
typedef struct HugeInteger
{
// a dynamically allocated array to hold the digits of a huge integer
int *digits;
// the number of digits in the huge integer (approx. equal to array length)
int length;
} HugeInteger;
}

[code]....

View 12 Replies View Related

C :: Program Keeps On Crashing When It Finishes Case 1?

Oct 18, 2013

The program keeps on crashing when it finishes case 1

View 5 Replies View Related

C++ :: Program Crashing On Exit While Multithreading

May 11, 2014

I was writing a program and it started crashing on exit (segment fault), after the 'return 0' in main(). I figure it's an std destructor.

I started with the program I was writing and just stripped out as much as I could, while making sure the crash persisted. If I remove any of the remaining code the crash disappears, even the seemly unrelated or scoped code.

#include <iostream>
#include <fstream>
#include <condition_variable>
#include <mutex>
#include <thread>

/* Call stack results:

[Code] ....

View 2 Replies View Related

C :: Program With Fscanf Keeps Crashing - Using Eclipse Kepler

Oct 13, 2013

So this program I have to make keeps spitting out an error report when I try and run it. I am using eclipse C kepler.

The file it is supposed to read has the following text;

R1 N001 N003 20
R2 N002 N001 5
R3 N001 0 10
R4 N002 N003 10
R5 N003 N000 5
I1 0 N002 10

View 2 Replies View Related

C++ :: Program Crashing When Reading Text From Files

Feb 5, 2014

I'm writing a code obfuscator in C. Debugger shows no errors in the code, but the program crashes after compiling -- I'm guessing it has something to do with while loops or reading data from files.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// list off all replaced elements
typedef struct ReplaceList {
char *from;// from string
char *to;// to string (random)

[Code] ....

View 3 Replies View Related

C++ :: Call A Program By System

Apr 17, 2013

So I know that I can call a program by system("prog.exe"), but what do I add in when I want to pass a parameter?

View 2 Replies View Related

C :: Call Another Program Via Shell Script

Oct 2, 2014

I'm trying to call another c program via shell script in c, but it just pop-up and close again.. here's my code:

char* command = "";
char temp[MAX_LENGTH] = "";

sprintf(temp, "gnome-terminal -e 'bash -c "./Isopropyl %s"'", editor -> filename);
command = malloc(strlen(temp) + 1);

if(command == NULL)
return;

strcpy(command, temp);
system(command);

View 1 Replies View Related

C++ :: Call External Application In Program?

Oct 27, 2014

I am trying to call an external application in my C++ program , example, system("C:Program FilesInternet Exploreriexplore.exe"); but the application just gets closed.

1. double slashes need to be used.
2. the command that worked for me was "ShellExecuteEx"

View 5 Replies View Related

C/C++ :: System Call A Command From Within A Program?

Sep 17, 2014

how to invoke a UNIX command within a program

I found this:

dd if=/dev/urandom of=myrandom bs=100 count=1

and I found this:

dd if=/dev/zero of=mytestfile.out bs=1 count=0 seek=1G

I want to call this command, by using the command line and typing Generate or something to that effect.

Basically, I want to be able to build random size files, content isn't important to me at this time.

View 8 Replies View Related

C :: System Call To Pause Execution Of Program For Few Seconds

Feb 2, 2014

I know there has to be a system call to pause (not system("pause") execution of a program for a few seconds. I would like to give the illusion that my program is 'thinking' rather than just spit out the result as soon as the user has hit the enter key.

View 5 Replies View Related

C :: Program To Check For Running Pid Using System Call In UNIX / Linux

Dec 11, 2013

I have written a program which uses a pid to check if the process is currently running and return a value based on the system call result.But the program core dumps

Code:

#include <stdio.h>
#include <string.h
int main( argc, argv )
int argc;
char * argv[];
{
int p_pid = 99;
char buff[1000];
}

[code]....

What is the mistake in this code and is it portable in both unix/linux , is the method secure (grepping for program name )?

View 6 Replies View Related

C++ :: Program To Call Relevant Functions To Calculate Final Price

Sep 14, 2014

I want this programming to call functions choose between a customer type and call the relevent function to calculate the final price but it is not calling the functions.

#include <iostream>
using namespace std;
double amount;
double studendOrPensioner(int&choice, double &origPrice);
double OtherCustomers(int&choice,double& origPrice);

[Code]...

View 1 Replies View Related

C :: Call Only One Time Malloc At The Start Of Program - Memory Size Is Growing

Jan 26, 2013

I have a program which call only one time malloc at the start of the program. When running, I see with 'process-explorer.exe' that memory is growing in little steps. Is this normal? why?

Using Windows 7

View 5 Replies View Related

C/C++ :: Convert Infix To Postfix Using Linked Lists And Stacks - Program Stop Working After 1st Call

Sep 28, 2014

I was given a task to convert infix to post fix using both linked lists and stacks in the code so this is what i have written but the problem is it is giving me same error at three different places "missing function header(old style format?)

#include <iostream>
#include <string>
using namespace std;
const int size = 100;
class stack{
private: // Declare a structure for the list

[Code] ....

View 12 Replies View Related

C :: Compiler Keeps Freezing / Crashing

Feb 11, 2014

I wrote this code as an assignment

Code:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
main(){

int story, age=0;
int ranColor, ranCar, ranItem;

[Code] ....

And my compiler keeps freezing/crashing. using Dec C++

View 4 Replies View Related

C++ :: Console Applications Keep Crashing

Jan 11, 2013

Any time I run my program after I make a selection from the menu the output is printed on the console screen then immediately a windows screen comes up saying project.exe has stopped working.

Below is my code, and I suspect the error has something to either

A) due with how I'm calling the method or
B) how I have the method coded.

Main
#include <iostream>
#include <fstream>
#include <string>
#include "telephone.h"
#include "tbook.h"

[Code] .....

View 4 Replies View Related

C/C++ :: Red Black Tree - App Keeps Crashing

Dec 8, 2014

Red Black Trees. [URL] .....

My app keeps crashing after about the 49th insert.

I tried debugging and it keeps pointing to this area in the Fixup:

if (z->parent == z->parent->parent->left) {
y = z->parent->parent->right;

View 13 Replies View Related

C++ :: Tail Stiva Crashing To Print?

Nov 17, 2014

i am trying to break a string and store it to a stiva (tail) i need my program to take one function like this

(a+10)* ((b+c)/(d-5)) + (9*2)

and return if it is editorial correct for example for the apper function has to return true but for this function

((a+10)*((b+c)/(d-5)) + (9*2)

has to return false.it crashes in the last part of my list i will put a comment

Code: #include<iostream>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<string>
using namespace std;
struct node{
char info;
node *back;
};

[code]....

View 2 Replies View Related

C++ :: Copy Constructor With Array Crashing

Oct 7, 2014

I know everything works except my copy constructor! There are no errors. The program crashes when it goes to access the copy constructor. why the copy constructor isn't working?

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <cstring> // access to C str functions
#include "String.h" // access String class
using namespace std;
String::String( int size )// default constructor

[code].....

View 2 Replies View Related

C++ :: Console App Crashing After Calling Function

Jul 18, 2014

Im new to debugging but it says the problem is on line 97 which is the verb menu function being called in the first switch statement case 0:

verb menu is one of the sub menus i want ,and it loads but then it crashes ...

#include <iostream>
#include <string>
#include "spanishverbs.h"
#include <windows.h>
#include <cmath>
#include <cstdlib>
using namespace std;
void nounmenu();

[Code] ....

View 3 Replies View Related

C :: Insertion Sort Function Crashing If 8 Or More Values?

Jan 15, 2015

This program I'm working on accepts an array size from the user, prompts the user to store that many integers, sorts them from smallest to largest, and then searches for duplicates with a simple for loop. The ultimate goal of the assignment was to display duplicates in an array, and the rest of the functions are just how I decided to reach that goal.

Anyway, my program crashes if I choose an array size larger than 7. It sorts and displays duplicates perfectly with 7 or fewer arguments.

The exact moment it crashes is after I enter the final value it prompts me for, so it appears my inputsize() function and my inputarray() function are working, and the error may be in the arrsort() function. Code is below:

Code:
#include <stdio.h>
int funcinputsize(int);
void funcinputarray(int [], int size);
void funcarrsort(int [], int size);
void funcdupe(int [], int size);

[Code] ...

View 4 Replies View Related

C :: Passing Array To Function And For Loop Crashing

Sep 23, 2014

The first problem i'm having is in the following code.

Code: #include<stdio.h>
#include<stdlib.h>
#include<time.h>
// program ask for max value and always returns random numbers < max

[Code].....

The ultimate goal of these two programs is to merge them and make one program that takes a max value from the user and fills up an array of (10^6) elements with values ranging from (0 to maxValue).

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved