C++ :: Can't Use System Commands

Nov 7, 2013

So, as far as I can tell, this code should run a system command from the C++ program:

system("ping 192.168.1.2 /t /l 32768");

However, I just keep getting a "system Was not declared in this scope" error message. Is there something wrong with this?

View 1 Replies


ADVERTISEMENT

C :: Gzip System Linux - Program To Unite 2 Commands Into 1 Command

Sep 15, 2013

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()?

View 3 Replies View Related

Visual C++ :: Send Commands Or Variables

Jul 19, 2013

I'm trying to create an executable with C or C++ that send a command with the function system, but it waits for a command or key.

Example :

I send this:

C:
unas /noprofile user:administrator notepad.exe

But it waits for password.

Please type the password :

So my question is how can I make to send the password or that my program detect that prompt.

View 1 Replies View Related

C++ :: Execution Of Certain Commands - Setting Device Time

Sep 10, 2013

I got a assignment in which i have to write codes for execution of certain commands.

One of the command is set_time. if user enters set_time 12:12:12

The time should get reset to 12:12:12 no matter what it is now.

View 7 Replies View Related

C++ :: How To Skip A Block Of Commands When User Interrupts

Nov 3, 2014

I am working on a program that does something like this,

Void main() {
cout<<"H";timedelay(1);
cout<<"E";timedelay(1);
cout<<"L";timedelay(1);
cout<<"L";timedelay(1);
cout<<"O";timedelay(1); //timedelay(int a) is a function which gives a delay of 'a' seconds.
{
....
}
}

This code is just for fancy and I would like to squish in some statements which would give the user an option to skip it (by entering any keyboard key),and resume with the rest of the program.

View 10 Replies View Related

C/C++ :: How To Use Windows Command-line Commands In Code

Sep 18, 2012

In Windows, if you open a command prompt, there are a bunch of keywords like, 'chdir', 'copy', ...

What I'm trying to figure out is how to use that COPY command in c++ code. I want to use the COPY command with the options (/a, /b, ...).

View 3 Replies View Related

C :: Netstat And PS Commands For Client / Server Socket Programming

Mar 3, 2013

I made client server program with fork ,without using signal handler because I want to see the status zombie for parent server, but when i execute "ps" command i didn't see anything for server or client pid or ppid ,i wonder about how to show the server and client process coz when i execute commad "ps" i saw only ps and bash processes???

View 1 Replies View Related

C :: Program That Displays Menu Of Commands For User To Choose From

Aug 1, 2013

I've read that we can write a program that displays a menu of commands for the user to choose from.We can write some functions that implement these commands, then store pointers to the functions in the array :

Code:
void ( *file_cmd[])(void) = { new_cmd , open_cmd }; // 2 cmd's for simplicity

We can get a similar effect with a switch statement but using an array of function pointers gives us more flexibility since the elements of the array can be changed as the programm is running.

I decided to write an example about this in order to understand better the context, I am facing some problems though :

Code:
#include<stdio.h>
#include<stdlib.h>
typedef void (*p_foo) (int);
void foo(int x);
void foo2(int y);

[Code] .....

The problems are :

Code:
TEST2.c:9: warning: initialization from incompatible pointer type
TEST2.c:9: warning: initialization from incompatible pointer type
TEST2.c:25: error: too few arguments to function "*(arr + (long unsigned int)((long unsigned int)i * 8ul))"

View 14 Replies View Related

C++ :: Recursive Function - Creating Vector Of Every Unique Combination Of Commands

Mar 24, 2013

I'm trying to write a recursive function that takes in a vector of strings that contains

"1 forward", "2 forward", "rotate left", "2 backwards" ... etc

how can I write recursive function that creates a vector of every unique combination of commands?

View 8 Replies View Related

C/C++ :: How To Make Food Ordering Program Utilizing Voice Commands

Apr 19, 2014

I was interested in making a food ordering program utilizing voice commands. I hope to build a GUI with items listed on one side, and with voice commands picking up on key words that will add the food to the right of what you chose.

View 4 Replies View Related

C# :: Open And Read CSV File One Line At A Time Using SQL Commands - OleDb Exception

Apr 7, 2010

The objective: Open and read a CSV file one line at a time using SQL commands.

The problem: I am getting an error that I have a feeling may not point to the "real" problem.

Where I may have syntax or other errors in code.

stInputConn = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=V:\IT\RE\Exports\;Extended Properties="text;HDR=YES;Format=Delimited(,)"";
OleDbConnection cn = new OleDbConnection(stInputConn);
stInputFileName = ConfigurationManager.AppSettings.Get("InputFile");
// the input file name is CSV_DataExport.CSV

[Code] .....

The last line (ExecuteReader) is where I get the OleDb Exception.

View 9 Replies View Related

C++ :: Why System Cannot Terminate Itself

Nov 18, 2014

#include <iostream>
#include <string>
using namespace std;

[Code].....

This is my code, when my pintrials = 0, my system cannot terminate but go through the option menu below.

View 1 Replies View Related

C :: Banking System - ATM Program

Mar 27, 2014

I am working on a project that is like a banking system and needs to include making a withdrawal, transaction, deposit, query, and transaction.

Code:
#include <stdio.h>
//#define true
//#define false
//assume there is money in the account. $10,000
void deposit(){

[Code] ....

View 1 Replies View Related

C :: Program For Ordering System

Mar 1, 2013

I just started my task with Ordering system. what should I use if I'm going to ask the user if he wants to exit the system, he will press(zero)0 to exit the program and press Y(uppercase or lowercase) to continue?

View 1 Replies View Related

C++ :: New Ordering System Sorting

Aug 2, 2014

Here's the objective of the program: "Instead of using ABCDEFGHIJ to order letters use DCBAJIHGF go order. The program should determine which 4-letter word is larger of two based on this new ordering system."

Not even sure how to start with this problem , how would I go about defining my own ordering system?

View 1 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++ :: GPA Evaluation System Through Array

Jun 2, 2013

Computerized GPA Evaluation System using Array

You are required develop a computerized GPA evaluation system of your class using array. The basic idea is to calculate the GPA (Grade Point Average) of each subject and then calculate the GPA of whole semester of all the students of the class and on the basis of that GPA calculate the grade and remarks of each student of the class. Suppose that the total students of the class are 50. Your system must also provide the facility of the following:

1.Searching a student result according to his/her roll number.
2.Updating the obtained marks of the students in case of any mistake in entering marks.
3.Display the result of student who is the topper of the class
4.Display the result of the student who got minimum CGPA out of the class.
5.Display how many number of students got greater than or equal to 3.0 CGPA.
6.Display how many number of students got greater than or equal to 2.00CGPA and less than 3.00.
7.Display the total number of students who got A grade in the semester.
8.Display the total number of students who got B grade in the semester.
9.Display the total number of students who got C grade in the semester.
10.Display the total number of students who got F grade in the semester.

Detailed Description:
You are required to take the student’s marks for four subjects (Programming fundamentals, Calculus, English and Computing) as input from the user at runtime. After that calculate the GPA of each subject and the whole semester. Assume that total marks of a subject are 100 and each subject is of 3 credit hours except programming fundamentals. Programming fundamentals subject has 4 credit hours.

Complete Assessment system is given below in the table:

S.#Percentage (%)GradeGPARemarks
185-100A4Excellent
280-84A-3.75Very Good
375-79B+3.50Good
470-74B3.0Satisfactory
565-69C+2.50Above Average
660-64C2.0Average
755-59D+1.50Pass
850-54D1.0Just Pass
9Below 50F0Fail

Table: Assessment Scheme
•Percentage of a subject = (obtained marks / total marks) * 100. Percentage works to find the grade of the student.
•GPA of whole semester = multiply GPA of each subject according to the percentage of obtained marks by the number of credit hours for that course, sum up the GPA of all the subjects, and then divide this sum by the total number of credit hours taken in semester.

For example suppose the GPA in subject X is 2.5, in subject Y 2.6, and in subject Z is 3. Assuming that each subject is of 3 credit hours then GPA of whole semester will be calculated as:
GPA= (3 * (2.5 + 2.6 + 3)) / 9
GPA= 2.7

On the basis of Semester GPA, you have to give grade and remarks to the student. You have to study the above table for other types of remarks according to grade.

•If a student has less than 50 marks in a subject, a message should display that “you have to repeat this subject “.

Code:

#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
main() {

char a,b,c,d;

[Code] .....

View 6 Replies View Related

C++ :: System Cannot Find The File Specified

Apr 4, 2013

I just purchased Visual C++ 2010 Ultimate, to start my coding experience. Whenever I try to debug, it gives me this error:

The system cannot find the file specified

It can't find the .exe file, I even Googled it, and tried a few things, without any luck.

View 2 Replies View Related

C# :: System Beep Sound?

Apr 22, 2014

I code login form. In the textbox I want to clear if there are some text or close form if there's nothing. The problem is System beep sound occured when the text is cleared. Here's my code

private void tbPassword_TextChanged(object sender, EventArgs e)
{
string _enteredPassword;
while (tbPassword.TextLength == 8)

[Code]....

View 2 Replies View Related

C# :: Creating A Reminder System?

Apr 26, 2014

I wanted create a Reminder Systems for my Project

So Scenario is like this,A Gym has owned a Software to maintain record of employee and customer, everything is ready now only reminder system is to be made. Reminder system is like for example if customer comes to gym and inquires about plan and fees and says call back him at so and so time, so receptionist will require reminder system to alert him at the time given by customer for call back.

What i have done

1.Created a Listview to show reminder list, and created two button ADD reminder and DELETE reminder When reminder is added following things are added in Reminder table in Database

i.ID
ii.Title
iii.Message
iv.Time
v.Date

2.when i display the reminder table in reminder listview, the order will be in (Date, time)asecnding order.

---Till here everything is done---

Now i am confused here, lets take example The first Reminder in Listview is around 3.00 clock, when the time is reached i want to show message that "call back this customer".

So to do this i was thinking of using timer and on each tick compare Current time with Reminder time, if equals display message, but this method is inefficient it can freeze my UI.

The Alternate way i was thinking to run this timer inside Background worker as it would create a different thread there will be no issue with my application.

View 5 Replies View Related

C/C++ :: System Cannot Find The File Specified

Jun 29, 2014

I can't debug anything and get an error whenever I try. Being able to release a program to run it works sometimes, but it's hit or miss. I've created a very simple program to show the problem. The error on the screen is a result of me trying to debug, but I actually received the same error when trying to release as well.

View 6 Replies View Related

C/C++ :: System Time And Enumerators

Mar 22, 2015

I need to take the system time and turn it into this format: 03:20 PM, Tuesday March 17, 2015. I am suppose to use 3 enumerators for the day of the week, the month, and AM or PM. I am having a lot of trouble with converting the system time to year, month, day, hour and minute. I also know there are a lot of functions that would make this more than simple, but I have to do the calculations and use enumerators. Here is what I have so far:

#include "stdafx.h"
#include <ctime>
#include <iostream>
#include <time.h>
using namespace std;
enum Days{SUN, MON, TUES, WEDS, THURS, FRI, SAT };
enum Months{JAN,FEB,MAR,APR,MAY,JUNE,JULY,AUG,SEPT,OCT,NOV,DEC};
enum Time{AM,PM};

[Code] ....

View 1 Replies View Related

C++ :: How To Reboot System With One Line Code

Apr 19, 2013

I need a short C++ code for reboot system(only c++)

can I do it?

View 13 Replies View Related

C++ :: Modelling Device In Embedded System?

Oct 13, 2013

What I want to do is abstract and model a device (more specifically in this case, an IMU) in an embedded system.

Now, there are a couple of gotchas:

- It is basically a framework, which means that it should work with any device, any platform and any bus.

- It is an embedded system, so power consumption and memory consumption must be reduced. It is not a PC.

- It cannot be too complex, because I fear that will just make people scrap it and rewrite it from scratch :P

- It should aim for as little code as possible to write the whole model, of course. Adding 100 lines of code for each register would be a bummer.

That said, I must also model the current system, which means that the current platform, the current bus (which is I2C) and the specific IMU model (I have a datasheet).
So the model I am thinking of currently is this:

First, I have a platform. It will know what bus a device is connected on and contains the buses (or specifically, the instances of the buses). It consists of a specific class for each platform and a base. Here are the two I have now:

Code:
namespace Sensors
{
template<typename Platform_t> class GPS;
}
namespace Platforms
{
class RaspberryPi: public PlatformBase

[Code]....

Currently I am making the assumption that all platforms will have an I2c bus and UART bus, but I'm not sure about that. We have only one platform ATM, though, so for now this holds. I'm guessing I might have to move it to the specific platforms later and get rid of PlatformBase.GetI2CBus is a problematic one related to registers, but I'll get back to that.

UART is simple to model since it's just a block read and write, so:

Code:
namespace Buses
{
class UART
{
public:
UART(const std::string& UARTPath): m_Open(false), m_PathToUART(UARTPath) {}

[Code]....

I'm probably going to handle all errors through exceptions. So if I can't open the UART bus, I'll throw an exception.

The I2C bus is a problem. I have a model which deals with it on a register-based level, but ideally I'd like to be able to model and use the devices on the I2C bus on a flag-based level (ie, I have names for each individual flag in the registers which I can read or write to directly instead of writing a hexadecimal value directly to each register).

Here is code:

Code:
namespace Buses {
template<unsigned int Id>
class I2CDevice {
public:
I2CDevice(I2C& Bus): m_Bus(Bus) {}
template<typename T>

[Code]....

So I2CDevice does some checks to see that the data to write to a register is either 8 or 16 bits. It does not check that the size to write matches the register's size, but another class does not.

The idea is also that it checks which device is currently active on the bus, and if it's not the current I2CDevice, then it simply selects that before attempting to read or write (the Open call).

This is not meant for multi-threaded environments. Yet, anyway.

The Impl2::Read/Write just dispatches the call so it calls the correct function for writing and reading the correct size, depending on the size of the data.

This is all well and good, but I2C works with registers, so of course I want a class to model a register which I can read and write to directly. It must tie into the bus class since the bus class is the one that abstracts reads and writes on the bus.

The register class looks like:

Code:
template<unsigned int Bits, unsigned int RegisterId, typename Bus_t>
class Register {
public:
typedef typename Impl::RegisterBase<Bits>::Storage_t Storage_t;
static_assert(!std::is_same<Bus_t, Buses::UART>::value, "Cannot read and write registers on the UART bus.");
static_assert(Bits == 8 || Bits == 16 || Bits == 32 || Bits == 64, "Number of bits must be 8, 16, 32 or 64.");
auto Write(Storage_t Data) -> void

[Code]....

I think this explains itself, except for the Regs struct, which is an experiment by me to enable myself to access registers via Regs.Config, etc.

What is missing is the ability to access and read/write the individual bits inside the registers. I am thinking a two-way access, where you can write to individual bits, but must call .Write() to commit the write to the register for efficiency.

I haven't actually written this. I don't know a good way ATM. I don't want to add a lot of variables and a write function because that would use 1 byte for every bit which is unacceptable.

I don't want to add a lot of code to make it work, either. A good get/set class would be nice, but I can't see that working. The register must store all state and any subsequent classes must not store any state or overhead will increase.

Finally, yes, I know a lot is incomplete and untested. It probably won't even compile. But that is for later. First is finishing the model.

It would be nice if things such as the platform and buses could be made static because there will only be one instance at any time, and that would save overhead if I don't have to store objects or references to them, but I haven't figured out how to achieve this.

View 13 Replies View Related

C++ :: Solar System With Key Action For Zoom In / Out

Apr 19, 2013

I have made a complete solar system with key action for zoom in zoom out, moving along x, y, z axes on plus or minus and going up/down/right/left. I am now in a bit of a dilemma. I want to add a text window ( i have made my project in visual studio 2010 in win32 console application) where to put a text like a description of each planet to appear when i hit the left mouse button. E.g. When i click with the left mouse button the Venus planet I want a description to appear in my text window. However I don't know how to put make a text window and how to correctly define the picking methods... for now everywhere i hit the mouse button it appears in to the console that i hit the sun.

View 10 Replies View Related

C++ :: Use Vector Or List For Database System

Jul 28, 2014

I am making a console based database system. Because I have to keep inserting, editing , deleting data blocks from my record file I have decided to use either vectors or list to store the all records. From the file I shall read the entire vector/list and work with it to add , remove or edit record and then again write the entire vector/list to the file again. I figured it would stop all the weird things that happen when directly working with the file. Is it an efficient way ?Or is it totally unnecessary ?Is there a better way?

View 2 Replies View Related







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