Thread: Use system("file location") to open root folder?

  1. #1
    Registered User muffinman8641's Avatar
    Join Date
    Feb 2011
    Location
    Eastern-Central PA
    Posts
    76

    Use system("file location") to open root folder?

    I (finally!) learned that you can use system("C:\\blah\\blah\\blah\\something.exe") to open a file; how can I turn that blah blah blah into a root folder? I need the program to open stuff in a folder that will be in my teacher's drop box for a school project.

  2. #2
    Registered User
    Join Date
    Sep 2010
    Posts
    69
    Quote Originally Posted by muffinman8641 View Post
    I (finally!) learned that you can use system("C:\\blah\\blah\\blah\\something.exe") to open a file; how can I turn that blah blah blah into a root folder? I need the program to open stuff in a folder that will be in my teacher's drop box for a school project.
    I'm not sure what you are asking.
    It sounds like you are asking for Console/DOS commands, but, I'm not sure what you mean.
    If that is the case, then that really has nothing to do with C++.

    If I'm wrong, then: "\\blahblah\\" is the exact path to whatever folder or directory and file you are looking for.
    Do you know the filename you are looking for and its path from the "root" ?
    ie: "C:\myfolder\myfile.exe"

  3. #3
    Registered User muffinman8641's Avatar
    Join Date
    Feb 2011
    Location
    Eastern-Central PA
    Posts
    76
    I'm basically looking for a way to make system("file location here") to open a file in the same folder rather than changing the source code to accommodate the new letter for my flash drive all the time.

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Be aware that this user is also getting advice here.

  5. #5
    Registered User
    Join Date
    Sep 2010
    Posts
    69
    Quote Originally Posted by muffinman8641 View Post
    I'm basically looking for a way to make system("file location here") to open a file in the same folder rather than changing the source code to accommodate the new letter for my flash drive all the time.
    Unless you know how to do "drive mapping" then you must specify the exact path to a file.
    If a file is on a network drive, then you must specify the network-drive path.
    If a file is on a local harddrive, then you must specify that local-drive. Like C:\ or D:\ .
    If a file is on a local flashdrive, then you must specify that flash-drive.

    Where is the file located ?
    What does the code you are using look like ?

  6. #6
    Registered User muffinman8641's Avatar
    Join Date
    Feb 2011
    Location
    Eastern-Central PA
    Posts
    76
    rags_to_riches - why does it matter if I use other forums? It just helps me get more answers.

    Anyway, it's on a network drive (Called F:\ on my computer but it might be different for my teacher).

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Here's why it MATTERS!
    How To Ask Questions The Smart Way

    If you've got 2 posts on the go, then someone else might go without getting their question answered at all, because you've got the same answer from two different places.

    OUR time is finite and precious - don't be a selfish person demanding answers all over the place.
    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.

  8. #8
    Registered User muffinman8641's Avatar
    Join Date
    Feb 2011
    Location
    Eastern-Central PA
    Posts
    76
    So you're telling me that I can only use YOUR forum for answers in case someone else comes along looking for the same answer, searches it, and sees this thread but not the other one?

  9. #9
    Registered User muffinman8641's Avatar
    Join Date
    Feb 2011
    Location
    Eastern-Central PA
    Posts
    76
    Quote Originally Posted by Salem View Post
    OUR time is finite and precious - don't be a selfish person demanding answers all over the place.
    Apparently, your time isn't precious enough NOT to be wasted trolling on this forum.

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Certainly too precious to waste on cross-posting idiots.
    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. dialog box: open folder : how to?
    By toby1909 in forum C++ Programming
    Replies: 2
    Last Post: 01-16-2002, 05:18 AM
  2. how do u open a folder?
    By nicola_diaz in forum C++ Programming
    Replies: 3
    Last Post: 11-24-2001, 04:22 PM
  3. how do u open a folder?
    By nicola_diaz in forum C++ Programming
    Replies: 2
    Last Post: 11-18-2001, 01:50 PM
  4. Ghost in the CD Drive
    By Natase in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 10-12-2001, 05:38 PM
  5. Programmatically open a Windows Folder
    By Shaman in forum Windows Programming
    Replies: 4
    Last Post: 09-25-2001, 03:39 PM