CString GetPDFFilename(CString strNumerisationRootPath, long lPatientID, CString strType) { const unsigned char MAXBITS = 7; unsigned char arShift1[MAXBITS] = { 0, 2, 4, 7, 10, 13, 16}; unsigned char arShift2[MAXBITS] = { 1, 3, 5, 8, 11, 14, 17}; int iDir1 = 0; int iDir2 = 0; for ( int i = 0; i < MAXBITS; i++ ) { iDir1 = iDir1 | (((lPatientID >> arShift1[i]) & 1) << i); iDir2 = iDir2 | (((lPatientID >> arShift2[i]) & 1) << i); } CString str; str.Format("%s\\X\\%2.2x\\%2.2x\\%i\\Numerisation.%s", strNumerisationRootPath, iDir1, iDir2, lPatientID, strType); return str; } and this is the code i have made PARAMETERS tcPathNum,tnIdpat LOCAL ARRAY arShift1(7) LOCAL ARRAY arShift2(7) LOCAL iDir1 LOCAL iDir2 arShift1(1) = 0 arShift1(2) = 2 arShift1(3) = 4 arShift1(4) = 7 arShift1(5) = 10 arShift1(6) = 13 arShift1(7) = 16 arShift2(1) = 1 arShift2(2) = 3 arShift2(3) = 5 arShift2(4) = 8 arShift2(5) = 11 arShift2(6) = 14 arShift2(7) = 17 iDir1 = 0 iDir2 = 0 FOR i = 1 TO 7 iDir1 = BITLSHIFT(BITAND(BITRSHIFT(tnIdpat,arShift1(i)),1),I) iDir2 = BITLSHIFT(BITAND(BITRSHIFT(tnIdpat,arShift2(i)),1),I) NEXT Those line in C++ give me som trouble iDir1 = iDir1 | (((lPatientID >> arShift1[i]) & 1) << i); iDir2 = iDir2 | (((lPatientID >> arShift2[i]) & 1) << i);TIA