Hey, I am creating a project that writes to a file. The problem is that I don't want it to write to a file on my computer but to a file on my server.

I am using this

ofstream myfile ("www.myurl.com/test.txt");

What I want to do is open that file on my server so then I can write things into it using c++

yet nothing is happening? Please help me :(

-- using Dev c++

Recommended Answers

All 2 Replies

you can't open a file like that. fstream only works with files on your local computer. You have to use sockets to send the data to the server, then the server has to have a program that will receive the file across the socket and write it to the server computer's file system.

If the server computer is on the same LAN as your local computer then you can just map a drive to it and use the drive letter like you do the c: drive letter.

Hey, never used them before, know any good tutorials? Or could you post an example please? Really need this, thank you :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.