Thread: File I/O on Network drive, Quick Question

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    3

    Angry File I/O on Network drive, Quick Question

    Hi,

    I'm having a problem calling a network drive as a computer name for file I/O.

    It works ok if I specify a drive letter with the path - eg. ofstream fp("g:\\dir1\\dir2\\stuff.txt", ios::app);

    But not working if i do this: ofstream fp("tdrscr123:\\dir1\\dir2\\stuff.txt", ios::app);

    Any ideas? anything will be helpful.

    Thanks!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    I thought it was
    \\machine\path\to\file.txt

    Which when written in code would be

    Code:
    ofstream fp("\\\\machine\\path\\to\\file.txt", ios::app);
    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.

  3. #3
    Registered User
    Join Date
    Nov 2003
    Posts
    3
    Thanks, i'll let you know how it goes.

  4. #4
    Registered User
    Join Date
    Nov 2003
    Posts
    3
    Works great. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File i/o and ASCII question
    By muzihc in forum C Programming
    Replies: 13
    Last Post: 11-04-2008, 11:46 PM
  2. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. quick question: File Input
    By meltingdude in forum C Programming
    Replies: 1
    Last Post: 04-08-2003, 02:02 AM
  5. File I/O problems!!! Help!!!
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 05-17-2002, 08:09 PM