whats wrong wif this code?

This is a discussion on whats wrong wif this code? within the C++ Programming forums, part of the General Programming Boards category; im trying to get my program to open exe's but it keep coming up with errors about this line: (open ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    4

    whats wrong wif this code?

    im trying to get my program to open exe's but it keep coming up with errors about this line: (open ios::in, ios::binary); i keep getting this error message: parse error before `::' token if anyone knows whats wrong plz post

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    25
    post your program...

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    4
    my program is too big to post but ill post the section where the broken code is
    Code:
     if (command=="openmirc")
         {
            ifstream fin;
            fin.open("c:\progra~1\mirc\mirc.exe");
           ("c:\progra~1\mirc\mirc.exe" ios::in, ios::binary);
         if (fin.fail())
         {
         cout << "Error Could not open mIRC.exe" << endl;
         
         }}

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    25
    im thinking is how u do the brackets. the brackets look wrong well thats what i think i dont know to the pros though

    im still a noob but im trying my best to understand and trying to help

  5. #5
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Code:
    ("c:\progra~1\mirc\mirc.exe" ios::in, ios::binary);
    This is supposed to do what exactly?
    Maybe you mean this:
    Code:
     if (command=="openmirc")
         {
            ifstream fin;
            fin.open("c:\progra~1\mirc\mirc.exe",ios::in|ios::binary);
           //("c:\progra~1\mirc\mirc.exe" ios::in, ios::binary);
         if (fin.fail())
         {
         cout << "Error Could not open mIRC.exe" << endl;
         
         }}
    I believe that will work
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  6. #6
    Registered User
    Join Date
    Jan 2003
    Posts
    25
    Code:
    //("c:\progra~1\mirc\mirc.exe" ios::in, ios::binary);
    why did u have to make that a comment?? shouldnt that be part of the program?
    im still a noob...

    ....but im trying my best to help people out

    ...doing that will help me understand more and more about c++


  7. #7
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Nope, I can't see how that line could work, I think he meant to open the file with the flags ios::in and ios:binary, so AFAIK you can OR them together using the open(file,flags) function
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  8. #8
    Registered User
    Join Date
    Aug 2003
    Posts
    4
    ok it dont come up with errrors anymore but it also doesnt open mirc.exe, sugestions anyone
    Last edited by darchonius; 08-23-2003 at 04:31 AM.

  9. #9
    Registered User
    Join Date
    Aug 2003
    Posts
    7
    You need to use "\\"...
    Code:
    fin.open("c:\\progra~1\\mirc\\mirc.exe",ios::in|ios::binary);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what is wrong in this simple code
    By vikingcarioca in forum C Programming
    Replies: 4
    Last Post: 04-23-2009, 08:10 AM
  2. what is wrong with this code please
    By korbitz in forum Windows Programming
    Replies: 3
    Last Post: 03-05-2004, 10:11 AM
  3. I cant find what is wrong with this code
    By senegene in forum C Programming
    Replies: 1
    Last Post: 11-12-2002, 06:32 PM
  4. Anyone see what is wrong with this code?
    By Wise1 in forum C Programming
    Replies: 2
    Last Post: 02-13-2002, 02:01 PM
  5. very simple code, please check to see whats wrong
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 10-10-2001, 01:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21