avec la deuxième méthode, en debug ça plante à ce niveau là
Au cas où, voici le code de ma fonction
Code : Sélectionner tout - Visualiser dans une fenêtre à part for(int i=0 ; i < NbLue ; ++i) vectorResult[PositionFichier + i] = BufferTmp[i];
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 std::vector<unsigned char> CObjetMetier::BlobToBlobVector(const OBlob & m_blob) { std::vector<unsigned char> vectorResult; short status= OLOB_NEED_DATA; int PositionFichier = 0; unsigned long size; unsigned long optchunk; unsigned int bufsize; size = m_blob.GetSize(); // calcul de la taille du buffertemporaire optimale optchunk = m_blob.GetOptimumChunkSize(); bufsize = ((int)(32768/optchunk)) *optchunk; if (bufsize > size) bufsize = size; unsigned char *BufferTmp = new unsigned char[bufsize]; unsigned long NbLue=0; while(status == OLOB_NEED_DATA) { NbLue = m_blob.Read(&status, BufferTmp, bufsize ); for(int i=0 ; i < NbLue ; ++i) vectorResult[PositionFichier + i] = BufferTmp[i]; PositionFichier += NbLue; } return vectorResult; }
Partager