   pointer buffers
  Well here's the deal:i got a pointer data:[source lang=c++]// A fictive class member descriptionFictiveClass::Fictivefunction(){//m_DataSize holds he number of data put into m_pDatam_DataSize = externalfunctionthatfilsdata(this->m_pData);}int main(){void * Buffer;//Create instanceFictiveClass * FCinstance = new FictiveClass();//While m_Data has stuff in it dowhile(FCinstance->m_DataSize>0){FCinstance->m_Data;//Ok here is the problem}return 0;}So I want all the data being stored in Bufferasif it was one datastream.   
  The code below is a best guess. Your post did not provide enough information about what you want to allow me to give you a correct answer, so I can only guess what you meant.DataType is the type of each 'data' object stored in m_Data, and m_DataSize is assumed to be the number of such objects in m_Data.DataType* target = reinterpret_cast<DataType*>( buffer );for( ;; ) {    FCinstance->fictiveFunction( );  if( FCinstance->m_DataSize == 0 ) { break; }  std::copy(FCinstance->m_pData,FCinstance->m_pData + FCinstance->m_DataSize,    target );  target += FCinstance->m_DataSize;}EDIT: modified after your 2nd post. Also, this obviously assumes that buffer points to a memory area that is large enough to contain the entire set of data you write to it.   ;  No what i ment is i want to retrieve the data in in m_Data and put it in the buffer, until there is no more data comming from the function. And i want this data being stored as one buffer (in the void * Buffer )   ;  Modified my suggestion above.Also, can you explain why you are doing this? It appears to me that your approach is highly inefficient and not very well designed, and I'm certain a simpler and cleaner solution exists.   ;#include <vector>#include <algorithm>class MyClass {  std::vector<DataType> myData;  // Don't mess around with pointers and counting sizes of dynamic memory.  // The standard library will provide...  public:  void fill() {    externalPutStuffInto(myData); // pass it by non-const reference.  }  template <class OutputIterator>  void copyEverythingTo(const OutputIterator& target) {    std::copy(myData.begin(), myData.end(), target);  }};int main() {  std::vector<DataType> Buffer;  MyClass tmp;  tmp.fill();  tmp.copyEverythingTo(std::back_inserter(Buffer));}