Thread: view network directory code

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    4

    view network directory code

    anyone know how I can read the directory of shared folder that is on a my lan using c++?

    I can use:
    system( "dir C:\\ > temp.txt" );
    to view my computer's directory

    I tried going into 'my network places' for the address of the folder
    \\CompName\shareddocs

    then tried
    system( "dir \\CompName\shareddocs > temp.txt" );
    and as I expected it wouldn't be that easy and gives me a file not found error

    so, how exactly would I be able to get those file names?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quick suggestion: If it's supposed to be \\Compname\shareddocs, shouldn't you use
    Code:
    system("dir \\\\Compname\\shareddocs > temp.txt");
    ?

    If that doesn't work, then we'll try thinking.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    4
    wow thanks that worked, I completely forgot to use escape characters on the sharedfolder's location

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 02:54 AM
  2. Reading a directory --code from FAQ
    By the bassinvader in forum C Programming
    Replies: 5
    Last Post: 11-11-2006, 02:40 PM
  3. View .htm... code in IE or Opera or Firefox
    By xxxrugby in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 03-09-2005, 07:09 AM
  4. Network Code!
    By SlimDady in forum C++ Programming
    Replies: 4
    Last Post: 04-05-2002, 07:16 PM
  5. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 12:51 PM