Link to home
Start Free TrialLog in
Avatar of fgs3124
fgs3124

asked on

How to fprintf to write out to a remote file

Being the novice, infrequent programmer that I am, I am trying to use the fprintf command to write data out to a file.  Simple enough.  In fact, I have done it on several occasions but this time there is a twist that my simple mind can't figure out.  I want to write out to a file location on another PC.  How can I do this?
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Hi fgs3124,

There are a couple of ways to do this, but both PCs have to cooperate for this to happen.

You can mount a drive on the remote PC using the Windows' "shared folders", unix's NFS mount, or Samba.  Then open the file on the shared drive and write to it.

You can also create a client/server application that "sends" the file from your system to the partner program on the other PC.


The bottom line is, it's a network environment and requires a network solution.


Kent
ASKER CERTIFIED SOLUTION
Avatar of ankuratvb
ankuratvb
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi fgs3124,
You can open/create a file residing on a share on another PC using the

\\machine\share\directory\...

syntax. Or use slashes instead of backslashes, should work, too.

Cheers,
Stefan
Hi fgs3124,

Kent is right ... you need permissions on the remote machine ....
Another way ... Maybe you can write the file locally and then invoke an ftp session to transfer the file ...

may be you can run a server on the remote machine that accepts the data and writes to the file locally ... it all depends on what kind of access you have on remote machine and what kind of setup you have

Sunnycoder