C++ :: Checking If A Program Is Running?

Jun 17, 2014

I have a question, how can I check if a program is running using c++? For example

if (notepad.exe is running) {
.... ..... ....

View 3 Replies


ADVERTISEMENT

C++ :: Running Unit Test On Library - Checking For NAN?

Jan 31, 2012

I am running a unit test on a library and this line keeps failing on Fedora 16, G++ 4.6.2

Code:
assertNAN(double, std::numeric_limits<double>::signaling_NaN()); //sanity check

The assert looks like this

Code:
//needs to copy it so that if its a function call it only does it once
#define assertNAN(type, one) {
type val = (type)one;
std::string lag(#one);
lag += " not a number";

[Code] ...

I am compiling with -DNDEBUG -O3 -ffast-math -fexpensive-optimizations to simulate a production environment. Is there a way to test for NAN consistently?

View 11 Replies View Related

C++ :: Quiz Program - Checking Whether Entered Answer Is Correct From A File

Apr 15, 2014

My code is not moving past the line below...actually i am making a quiz and this piece of code id checking whether the entered answer is correct, from a file..

getline(anss,saveans);
while(a<1) {
getline(anss,saveans);
if (saveans == ToString(randNum)) {
getline(anss,saveans);
if (saveans == ans)

[Code] ....

View 9 Replies View Related

C++ :: Running A Program Outside IDE

Jul 23, 2014

after you have compiled a program can you run it without an IDE?

View 17 Replies View Related

C++ :: Running A SLR Parser Program?

Apr 27, 2012

I need to run a program that makes a SLR Parser Table.

Here is the code :

Code to find first and follow:

saved as SLR.h
#include<stdio.h>
#include<ctype.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream.h>
#define epsilon '^'

since I didn't know how to type epsilon symbol temporarily I am using ^

char prod[20][20],T[20],NT[20],c[10][10],foll[10][10],fir[10][10];
int tt,tnt,tp,a;
int follow[20][20],first[20][20];
void first_of(char);
int count(int j);
void rhs(int j);

[code]....

View 3 Replies View Related

C :: Queue Program Not Running After Pressing 1

Apr 20, 2013

Code:

#include<stdio.h>
#include<process.h>
struct que

[Code].....

View 1 Replies View Related

C/C++ :: Program Is Running But It Won't Stop Compiling

Nov 20, 2014

#include <iostream>
using namespace std;
int main() {

[Code].....

View 2 Replies View Related

Visual C++ :: Running GUI Program In Background?

Apr 22, 2013

i created a windows service that will run another program. but the program i want to run has a gui and i don't want the gui to be visible, i just want the program to run in the background.

But i have to do it without editing the gui program

here's my code:

Code:
TCHAR* path = L"C:Myfile est.exe";
STARTUPINFO info = {0};
PROCESS_INFORMATION processInfo;
ZeroMemory( &info, sizeof(info) );
info.cb = sizeof(info);

[code]....

i tested this code with notepad and it runs notepad in the background without displaying the window but when i try run my program it doesn't work. i don't know why its works for one program and not the other..

View 14 Replies View Related

C++ :: Dynamically Resizing Array While Program Is Running?

Feb 4, 2015

I'm working the 4th problem in chapter 14 of the Jumping into C++ book. In the book, he gives an example program for dynamically resizing an array while the program is running. It works fine for integer types but i need to do the same with a string type array. Right now my program is crashing because the string array is not resizing itself. Here's the part of the code im trying to figure out. The part for the int array has been ignored using // since it works fine and I'm trying to figure out whats wrong with the string array.

Code:
#include <iostream>
#include <string>
//Write a program that lets users keep track of the last time they talked to each of their friends.
//Users should be able to add new friends (as many as they want!) and store the number of days ago

[Code]......

View 8 Replies View Related

C :: Program Compiles Fine But Seg Faults While Running

Dec 1, 2013

So i compile fine, but when i run my program, after the printf it just segfaults (core dumped)...

Code:
#include<stdio.h>#include<string.h>
#include<stdlib.h>
void main() {
unsigned int j=0, max=9;
char num[100] , str1[100], str2[max];
FILE *fp;

[Code] .....

View 4 Replies View Related

C :: Simple File And String Program Not Running

Mar 6, 2015

The assignment is to write a program that statistically computes similarity of C syntax with another program; a same and a different. The one used here is in C language, it's called Battleship.cpp. The program must open a file and read line by line for keywords and then produce statistics. The reason my code is not running is the fopen function is failing and it goes to return -1. I am using MS Visual Studio 2013 and there are no compiler errors after turning off deprecation. I do see, however, this error UMEngx86.dll'. Cannot find or open the PDB file. The file being opened is in my source folder.

Code:
1
2
3
4
5
[code]....

View 4 Replies View Related

C++ :: Setting Background Color And Running A Program

Feb 1, 2013

I use turbo c++ 3.0

How to set the background color using the function setbkcolor() in graphics.h

will i need to run the exe file in full screen if i use this function?

View 4 Replies View Related

C/C++ :: Full Menu Not Shown When Running Program

Mar 4, 2014

The program is not showing my full menu just the 0 Exit and the last line of text. This is the full main source file (not implementation file or header file).

#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <vector>
using namespace std;
struct menuItem{
string itemDesc;
double price;
int menuType;

[Code] .....

View 3 Replies View Related

C++ :: Destructor And Inheritance Causing Program To Crash After Running?

Dec 13, 2013

I have a class which dynamically allocates memory for three data arrays, and as such in the destructor I told it to delete those data arrays.

However, when I've created a new class, and inherited the previous class - it will always crash AFTER running the program, unless I don't have the previous destructor present.

View 3 Replies View Related

C/C++ :: Check Printing Program Breaks Halfway Through Running

Apr 3, 2015

For my c++ we're suppose to write a program that prints out a check. It's suppose to translate the numeric value of the dollars to worded strings.

Header File:

#ifndef CHECKWRITING_H
#define CHECKWRITING_H
#include <string>

[Code]....

View 1 Replies View Related

C++ :: Running Infix To Postfix Stack Conversion Program

Mar 27, 2014

I keep getting the same error messages every time on Visual Studio. I don't know where the error is originating. Basically I'm trying to convert an infix expression (A+B-C) to a postfix expression (AB+C-) using stacks.

#include <iostream>
#include <fstream>
#include <string>
#include <stack>
#include "Expression.h"
#include "stackType.h"
using namespace std;
int main() {
string fileName;
string infixExpression, postfixExpression;

[Code] .....

View 2 Replies View Related

Visual C++ :: Command Prompt - Running GUI Program In Background?

May 2, 2013

No I definitely used Visual Studio Command Prompt

c:Program FilesMicrosoft Visual Studio 9.0VC
un_process_from_service>make.bat

View 7 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 :: Reversing Every K Nodes Of Linked List - Program Crashes While Running

Mar 11, 2013

The code below is for reversing every k nodes of the linked list. While running the Program it crashes.

Code:
#include<stdio.h>
#include<stdlib.h>
struct node {
int info;
struct node *next;

[Code] ....

View 1 Replies View Related

C :: Bit Checking - Stack Overflow

Sep 19, 2013

I usually check if a bit is set using:

Code: bit = (number >> n) & 1; where `n` is the bit I want to check...

But I came across a stackoverflow answer saying:

bit = number & (1 << x); will not put the value of bit x into bit unless bit has type _Bool (<stdbool.h>).

Otherwise, bit = !!(number & (1 << x)); will..

So why is this? why the double !?

View 5 Replies View Related

C :: Checking Whether A String Is Palindrome Or Not

Nov 4, 2013

Everything seems to be correct from my perspective. heres the program: Code: /*c program to check whether a string is palindrome or not*/

#include<stdio.h>
#include<string.h>

int main(void) {
char str[30];
int i,j,flag=0;

[Code] .....

View 1 Replies View Related

C :: How To Turn Up Error Checking On IDE

Dec 8, 2013

The reason being is that it says that my program is right

Code:
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define NFlights 10
struct date {
int month;
int day;
int year;
int hour;
int minute;

[Code] ....

View 6 Replies View Related

C :: Language Syntax Checking

Jun 15, 2013

Q. In context of C language syntax checking, which of the following can be modeled using Finite Automata?

(A) Detecting proper termination of an instruction.
(B) Detecting balance of parentheses.
(C) Detecting initialization of a variable.
(D) None of the above.

View 4 Replies View Related

C++ :: Checking If Key With Modifier Pressed?

Jan 31, 2015

I am new to C++ , i want to know how to check if a key with modifier is pressed.

When I use GetAsyncKeyState() it gives me error identifier not found.

View 1 Replies View Related

C++ :: Checking For 3D Primitive Collisions

Aug 4, 2013

I think I may have found a new way of checking for 3d polygon collisions, but I'm not sure. The method involves...

1. finding the planes that the primitives lie on
2. finding the line where the planes intersect
3. if both polys have points on both sides of the line AND have points that overlap on the 1d space of the line, then they intersect.

I have some half done code testing this, and so far it seems to be sound and fairly fast. These are some average time-tests done on my machine for each part:

1. 30 microseconds (both)
2. 7 microseconds
3. TBD

View 5 Replies View Related

C++ :: Checking For Deallocated Memory?

Jul 20, 2014

How would I go about checking for deallocated memory?

For example, let's take this into consideration:

// Unsigned 32-bit / 64-bit integer: uint32, uint64
uint32* Pointer = new uint32[ Size ];
uint64 MemAddr = ( uint64 ) Pointer;
delete[] Pointer;

The above code would proceed to create a new array, store it in a pointer and retrieve the memory address of the array before finally deleting the array.

So let's assume we re-build the pointer and try to access the now deallocated array:

Pointer = ( uint32* ) MemAddr;
Pointer[ 0 ] = 0;

Based on the above snippets of code, how would I check "Pointer" after rebuilding the memory to check if the rebuilt memory has actually been deallocated. Without a check we'd get an exception error.

A bit of detail on why I am trying this:

Before thinking up how to do this, I was storing the addresses in a list and check the list for the addresses to see if they existed or not. However this requires an O(n) search, which isn't exactly what I am wanting. So instead if I used a check for deallocation method, I can go for an O(1) time check and reduce the total time it would take to check for memory allocation/deallocation.

View 11 Replies View Related







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