0

Well, I've see this question about my problem and the solution seems to be good. Send and Receive a file in socket programming in Linux with C/C++ (GCC/G++)

Well. My goal is to receive a txt file and after receiving it, I want to store it into a path. I have now a question: when I receive the bytes through the recv function, how can I merge all bytes into a txt file?

Community
  • 1
  • 1

1 Answers1

1

I think std::ofstream is what you are looking for.

ronag
  • 49,529
  • 25
  • 126
  • 221
  • Or `fopen`/`fwrite`, which continue to work just fine in C++ and tend to be considerably faster. – Ben Voigt Nov 17 '11 at 15:22
  • 1
    @BenVoigt: If you like C files, check out my [wrapper](http://codereview.stackexchange.com/questions/4679/shared-ptr-and-file-for-wrapping-cstdio) :-) – Kerrek SB Nov 17 '11 at 15:24