Thread: launch applications with spaces?

  1. #16
    Registered User
    Join Date
    Jan 2002
    Posts
    27
    thx guys. Now i just made a .bat file in each dir and run the bat file

    batfile:
    cd c:\games\tibia
    tibia.exe

    thx again

    great board

  2. #17
    Registered User
    Join Date
    Jan 2002
    Posts
    5

    prob with input of dir with spaces

    I havn't got this to work, pls help somebody.

    cin>>oppnaFil;
    if((strcmp("1",oppnaFil)==0))
    val2();
    else
    ShellExecute(NULL, "open", oppnaFil, NULL, NULL, SW_SHOWNORMAL);

    Nevermind the variabels, they're in Swedish . What I wanna do is to be able to lauch a file (oppnaFil), that's in a dir with spaces, how do I do that? If I input: \"c:\\spel\\half life\\hl.exe\"
    for example, it doesn't work.

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    cin>>oppnaFil;

    Try
    cin.getline(oppnaFil);

  4. #19
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    almost right...

    try creating a buffer ( char array)

    char buffer[255];
    then get a line into it like this...

    cin.getline(buffer, sizeof(buffer));

    That will read a string completely up to the 254th char inserting a null byte after the last char read.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Get Installed applications list and applications activity
    By arunarora in forum C++ Programming
    Replies: 5
    Last Post: 05-25-2009, 09:41 AM
  2. Changing 3 spaces to tabs
    By dnguyen1022 in forum C Programming
    Replies: 2
    Last Post: 12-22-2008, 12:51 AM
  3. A question about windows programming
    By Hussain Hani in forum Windows Programming
    Replies: 16
    Last Post: 05-23-2007, 07:38 AM
  4. Tabs or Spaces
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 46
    Last Post: 04-08-2007, 11:45 AM
  5. Replies: 5
    Last Post: 06-30-2003, 12:52 PM