Salve,
sono alle prese con il seguente codice:
quindi per accedere in scrittura alla struttura buffer devo attraversare la struttura circular. Secondo voi posso aggiungere nella struttura circual un costruttore che mi eviti di fare:codice:struct buffer { unsigned char data[1024]; int bytesRecorded; int user; buffer(const unsigned char * data_, const int bytesRecorded_, const int user_) : bytesRecorded(bytesRecorded_), user(user_) { std::copy(data_, data_ + bytesRecorded_, data); } }; struct circular { boost::circular_buffer<buffer> cb[numbuff]; }; int main() { char szTime[30]; getDateTime(szTime); circular c; c.cb[0].push_back(buffer((unsigned char*)szTime, 30, 1)); Sleep(1000); c.cb[1].push_back(buffer((unsigned char*)szTime, 30, 2)); Sleep(1000); c.cb[2].push_back(buffer((unsigned char*)szTime, 30, 3)); Sleep(1000); }
così che posso fare magari: Circular c((unsigned char*)szTime, 30, 1)) ???codice:c.cb[0].push_back(buffer((unsigned char*)szTime, 30, 1));
forse anchio mi sono perso nel tragitto della struttura...
grazie



Rispondi quotando