Quick Programming Help

Discussion in 'Programmer's Corner' started by Aamer04, Aug 26, 2010.

  1. Aamer04

    Thread Starter New Member

    Aug 19, 2010
    4
    0
    While my program is running I want to type in the characters "n" and "p" to open a notepad file thats in the c drive.

    I know this is easy but I forgot how to do it. Can someone help me out? The software I'm using isn't visual basic but its based off of it and is very similar.
     
  2. Aamer04

    Thread Starter New Member

    Aug 19, 2010
    4
    0
    Forgot to mention, everything is very similar if not the same except for the fact that the datatype "char" is not available.

    Any tips on you would do this in C/C++/VB without using Char....I don't need the "n" and "p" specifically, any keyboard input would work
     
  3. someonesdad

    Senior Member

    Jul 7, 2009
    1,585
    141
    I don't use VB, so I can't help you there. In C you'd probably use something like getchar and C++ could use cin. Consult any basic programming text for the details. Once you've gotten the requisite character, you'll probably want to make a call to a Windows function like ShellExecute to help you open notepad.

    Note: if you're programming in a GUI environment, things may not be this simple, as sometimes a console-type device isn't available and you need to use the tools in the GUI framework.
     
  4. Aamer04

    Thread Starter New Member

    Aug 19, 2010
    4
    0
    hey thanks for the tips! I'm not sure why but I can't open the notepad document I want using shell...weird because I used shell to open something simple..like the calculator and it worked fine. Could it be something with permissions on my pc user account??
     
Loading...