Go to another directory and display file

This is a discussion on Go to another directory and display file within the C++ Programming forums, part of the General Programming Boards category; Hi, I would like my program to go to another directory and open a text file with notepad. Currently I ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Location
    Ballincollig, co. cork, Eire
    Posts
    22

    Go to another directory and display file

    Hi,

    I would like my program to go to another directory and open a text file with notepad. Currently I am trying to do it with the following code, with no success.

    Code:
    system("c:");
    system("cd users/emibrow/Documents/MATLAB");
    system("notepad starttime");
    Does anybody have any ideas?

    Brownie
    Thanks

    Brownie

    ### Novice programmer since forever ###

    ### Currently using Microsoft Visual C++ 2008 Express Edition on Windows Vista ###

  2. #2
    Registered User
    Join Date
    Feb 2006
    Location
    Ballincollig, co. cork, Eire
    Posts
    22
    Sorry,

    forgot to mention. I do have windows.h included, so the system command is working ok. The problem is just with changing directory:

    system("cd users/emibrow/Documents/MATLAB");
    that line of code
    Thanks

    Brownie

    ### Novice programmer since forever ###

    ### Currently using Microsoft Visual C++ 2008 Express Edition on Windows Vista ###

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Why not give the full path to notepad?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 20
    Last Post: 02-23-2010, 01:49 AM
  2. Lost in C
    By David670 in forum C Programming
    Replies: 8
    Last Post: 10-31-2005, 11:19 PM
  3. directory file openong
    By deian in forum C Programming
    Replies: 4
    Last Post: 07-21-2004, 02:37 AM
  4. Replies: 4
    Last Post: 10-21-2003, 05:28 PM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 05:10 PM

Tags for this Thread


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