Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help for tanslating C++ to VFP
Message
 
À
21/10/2009 12:20:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01430425
Message ID:
01430427
Vues:
72
>Hi all :)
>
>I have to convert this C++ code to vfp and my knowledge is very limited in C++
>
>can some one help me to translate it ?
>
>this is the c++ code
>
>
>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
>Benoit
FOR i = 0 TO 6
    iDir1 =  BITOR(iDir1, BITLSHIFT(BITAND(BITRSHIFT(tnIdpat,arShift1(i+1)),1),I))
    iDir2 =  BITOR(iDir2, BITLSHIFT(BITAND(BITRSHIFT(tnIdpat,arShift2(i+1)),1),I))
NEXT 
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform