File I/O on Network drive, Quick Question

This is a discussion on File I/O on Network drive, Quick Question within the C++ Programming forums, part of the General Programming Boards category; Hi, I'm having a problem calling a network drive as a computer name for file I/O. It works ok if ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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, 10: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

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