write buffer rejecting two bytes in file

Oct 22, 2013 at 12:26pm
Hello!
I have question that i want to write buffer of size 1470 bytes in file but condition is that it should reject first two bytes and write remaining 1468 bytes to file.How done this??


Last edited on Oct 22, 2013 at 12:27pm
Oct 22, 2013 at 1:02pm
closed account (o3hC5Di1)
Hi there,

Assuming your buffer is a char-array:

1
2
3
4
5
6
7
8
#include <iterator>
#include <algorithm>

char buffer[1470];
std::ofstream file("yourfile.txt");

std::ostream_iterator<char> ostr_it(file);
std::copy(buffer+2, buffer+1469, ostr_it);


All the best,
NwN
Oct 29, 2013 at 10:52am
Thanks!!
Topic archived. No new replies allowed.