All welcome. I'm trying to get an image on the socket.
There was such a problem:
It is necessary to create an array from the array in order to create an array exclusively with an image, without any garbage.
Tried to do this:
while (ignored_error != boost::asio::error::eof) { boost::array<char, 10000> RECV_DATA; // ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠ΅ "Ρ ΠΌΡΡΠΎΡΠΎΠΌ" size_t ImageSize = image_recver.read_some( boost::asio::buffer(RECV_DATA), ignored_error); char complete[ImageSize]; // ΠΠΎΠ»ΠΆΠ΅Π½ Π±ΡΡΡ ΠΌΠ°ΡΡΠΈΠ² Π±Π΅Π· ΠΌΡΡΠΎΡΠ°, ΠΈΡΠΊΠ»ΡΡΠΈΡΠ΅Π»ΡΠ½ΠΎ ΡΠ°ΠΌΠΎ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠ΅ for (int i = 0; i < ImageSize; i++) { complete[i] = RECV_DATA[i]; // Π·Π°ΠΏΠΎΠ»Π½ΡΠ΅ΠΌ ΠΌΠ°ΡΡΠΈΠ² } cout << ImageSize << " : " << complete.size() << endl; // ΡΠ±Π΅ΠΆΠ΄Π°Π΅ΠΌΡΡ, ΡΡΠΎ ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° ΡΡ
ΠΎΠΆ Ρ ΡΠ°Π·ΠΌΠ΅ΡΠΎΠΌ ΠΏΠΎΠ»ΡΡΠ΅Π½Π½ΠΎΠ³ΠΎ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ } But I got the following error:
E0028 expression must have a constant value. OpenCvTest D: \ C ++ Projects \ ImageRecvTest \ ReceiveImage.cpp 33 the value of the variable "ImageSize" (declared in line 30) cannot be used as a constant
I tried this:
char *complete[] = new char[ImageSize]; But here I got an error:
E0520 for an aggregate object, initialization is required using "{...}"
What to do?
char * complete = new char[ImageSize];,char *complete[]declares an array of pointers - VTT