473,508 Members | 4,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

system() problems

5 New Member
So my girlfriends dad asked me to build a program for his grandkids. The program is supposed to give them a little pop quiz before accessing the internet. I did a basic c++ program in win32 application so nothing fancy. I am at the end of the program and ran into problems only on his computer. The first problem was his username which had a space in it. The path was "c:\Users\t p\AppData\Local\Google\Chrome\Application\chrome.e xe". The problem was that it would only read "c:\Users\t". The new problem is that the path is "c:\Program Files (x86) . . ."
How do I get the system to read the full path and not just "C:\Program"
My code is below.

Expand|Select|Wrap|Line Numbers
  1. #include <iomanip>
  2. #include <iostream>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <Windows.h>
  6.  
  7. using namespace std;
  8.  
  9. void question1(void);
  10.  
  11. int answer1;
  12.  
  13. void question1()
  14. {
  15.    do
  16.    {
  17.       cout << "5 + 5 = ";
  18.       cin >> answer1;
  19.       if (answer1 == 5) break;
  20.       {
  21.          cout << "Try Again" << endl;
  22.       }
  23.    }while(true);
  24. }
  25.  
  26. int main()
  27. {
  28.    cout << "Hello Pop." << endl;
  29.    cout << "To use the internet you must answer these 5 questions" << endl;
  30.    cout << "Question 1" << endl;
  31.    question1();
  32.  
  33.    cout << "Great Job" << endl;
  34.  
  35.    system ("c:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
  36.  
  37.    cout << "See you next time" << endl;
  38.  
  39.    cout << system("PAUSE");
  40.  
  41.    return 0;
This program works fine on my computer as the path is "c:\\Users\\Owner\\AppData\\Local\\Google\\Chrome\ \Application\\chrome.exe"

I am only having problems with the spaces on the other computer path.
Oct 24 '12 #1
3 1650
Rabbit
12,516 Recognized Expert Moderator MVP
Please use code tags when posting code.

Put some escaped quotes around the system call.
Oct 24 '12 #2
CALIxPAPI916
5 New Member
Where exactly would the escape quotes go? Sorry I am burnt out by this small problem.
Oct 24 '12 #3
Rabbit
12,516 Recognized Expert Moderator MVP
In your system call one after the first quote and one before the last quote.
Oct 24 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3543
by: Justin Lemkul | last post by:
Hello all, I am hoping someone out there will be able to help me. I am trying to install a program that utilizes NumPy. In installing NumPy, I realized that I was lacking Atlas. I ran into...
0
1284
by: Jesper Stocholm | last post by:
I am using the example as the basis for an application I am currently writing. The setup consists of two applications (client and server) that talk to each other thru TCP. I have no problems...
21
2908
by: matvdl | last post by:
I have a system that was originally developed in asp - the pages are saved in SQL (there are over 10,000 pages) and saved to a temp directory in the server when requested by a client. I have...
2
5687
by: Joel D. Kraft | last post by:
I've been very happy with the performance and new features of my site since we converted to ASP.NET 2.0 beta 2. I have noticed a couple of interesting problems, though, which I am trying to...
2
1235
by: Jack Fox | last post by:
We are encountering a couple of problems with our ASP.NET / IIS 6.0 applications: In each of 3 production environments we maintain a Windows Server 2003 machine running NTFS as a file server....
0
1702
by: neoret | last post by:
Hello. I have developed an application (an office addin).The application works fine with no error messages on my devoping machine (that machine is not connected to any domains). I have...
0
1124
by: neoret | last post by:
Hello. I have developed an application (an office com addin).The application works fine with no error messages on my devoping machine (that machine is not connected to any domains). I have...
9
2392
by: =?Utf-8?B?SG93YXJkIFNtaXRo?= | last post by:
I am using VC++ 6.0 (with SP5 installed). When using WinXP this is with SP2 installed. I am developing an instrumentation system comprising a set of networked PCs connected using TCP/IP TCP links....
34
5297
by: Alexnb | last post by:
Gerhard Häring wrote: No, it didn't work, but it gave me some interesting feedback when I ran it in the shell. Heres what it told me: Traceback (most recent call last): File...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.