A few quick questions...

This is a discussion on A few quick questions... within the C++ Programming forums, part of the General Programming Boards category; Hello, I am writing a few quick games mostly for exerimentation's sake, and I'd like to write a simple installation ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,422
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,422
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 09:06 AM
  3. A quick question(s)
    By EvBladeRunnervE in forum C++ Programming
    Replies: 3
    Last Post: 02-17-2003, 08:39 PM
  4. Quick Inheritance questions
    By VanJay011379 in forum C++ Programming
    Replies: 1
    Last Post: 07-22-2002, 09:21 AM
  5. 2 quick questions
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 11-28-2001, 11:32 PM

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