Thread: A few quick questions...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    17

    A few quick questions...

    Hello,

    I am writing a few quick games mostly for exerimentation's sake, and I'd like to write a simple installation program. How would I get a path from the user (ex. C:\thegame) and then install my files to that path? I know about the system() command, but it doesn't let you specify variables in between it's " and "... at least I don't think it does?

    Another question: is there a function/class/SOMETHING to route output to the printer in C++ (not C plz)? I'd really appreciate an answer on this because it would be fun to mess around with.

    Anyways, if anyone can answer my 2 questions, I'd appreciate it.
    ------------------------------------------
    Normally I'd put something clever, but that isn't the point of being here now is it?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > get a path from the user (ex. C:\thegame) and then install my files to that path?
    You have to construct your system() command strings at run time
    Say like this
    Code:
    char path[100];
    cout << "Install where? ";
    cin >> path;
    char cmd[200];
    sprintf( cmd, "md %s", path );
    system( cmd );
    If you want to use some c++ (like strstreams) for creating the string, that's up to you.

    > is there a function/class/SOMETHING to route output to the printer in C++
    Nothing standard - it depends on
    - your OS
    - your compiler
    - where your printer is plugged in
    - what type of printer it is
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    17

    What is sprintf()?

    Hello,

    First, thx for your reply; it does make sense! But could you explain sprintf()? I know about fprintf() and printf(), but sprintf() is a new one to me.

    Thx
    ------------------------------------------
    Normally I'd put something clever, but that isn't the point of being here now is it?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > But could you explain sprintf()?
    directs its output to a char array (not to a file (fprintf) or to the screen (printf))
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Two quick questions about open file dialog boxes
    By PJYelton in forum Windows Programming
    Replies: 5
    Last Post: 04-05-2005, 08:49 AM
  2. Questions on basic Quick Sort
    By Weng in forum C++ Programming
    Replies: 4
    Last Post: 12-16-2003, 10:06 AM
  3. A quick question(s)
    By EvBladeRunnervE in forum C++ Programming
    Replies: 3
    Last Post: 02-17-2003, 09:39 PM
  4. 2 quick questions
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 11-29-2001, 12:32 AM