IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB 6 et antérieur Discussion :

ligne de log. .


Sujet :

VB 6 et antérieur

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2007
    Messages : 73
    Par défaut ligne de log. .
    est ce que qq'un peu m'expliquer cette ligne???


    Print #FileLog, "I:Find table '" + tablename + "' from universe '" + strFileList(intN) + "'"

    (Universe etant un univers pour Business Object)
    C'est surtout le Print #FileLog qui me pose probleme...

    Merci d'avance

  2. #2
    Membre Expert Avatar de OhMonBato
    Homme Profil pro
    Inscrit en
    Mars 2007
    Messages
    2 660
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Morbihan (Bretagne)

    Informations professionnelles :
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2007
    Messages : 2 660
    Par défaut
    Ca semble être un enregistrement dans un fichier texte.

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2007
    Messages : 73
    Par défaut
    EN fait je dois transformer cette ligne (et bien d'autre) en C++...

    donc si qq'un si connait...

  4. #4
    Membre Expert
    Avatar de zazaraignée
    Profil pro
    Étudiant
    Inscrit en
    Février 2004
    Messages
    3 174
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2004
    Messages : 3 174
    Par défaut
    FileLog est un nom de variable pour le numéro du fichier. C'est obligatoirement ça. En appuyant sur , tu aurais trouvé ceci:
    Citation Envoyé par MSDN
    Print # Statement


    Writes display-formatted data to a sequential file.

    Syntax

    Print #filenumber, [outputlist]

    The Print # statement syntax has these parts:

    Part Description
    filenumber Required. Any validfile number.
    outputlist Optional.Expression or list of expressions to print.


    Settings

    The outputlistargument settings are:

    [{Spc(n) | Tab[(n)]}] [expression] [charpos]

    Setting Description
    Spc(n) Used to insert space characters in the output, where n is the number of space characters to insert.
    Tab(n) Used to position the insertion point to an absolute column number, where n is the column number. Use Tab with no argument to position the insertion point at the beginning of the nextprint zone.
    expression Numeric expressions orstring expressions to print.
    charpos Specifies the insertion point for the next character. Use a semicolon to position the insertion point immediately after the last character displayed. Use Tab(n) to position the insertion point to an absolute column number. Use Tab with no argument to position the insertion point at the beginning of the next print zone. If charpos is omitted, the next character is printed on the next line.


    Remarks

    Data written with Print # is usually read from a file with Line Input # or Input.

    If you omit outputlist and include only a list separator after filenumber, a blank line is printed to the file. Multiple expressions can be separated with either a space or a semicolon. A space has the same effect as a semicolon.

    ForBoolean data, either True or False is printed. The True and False keywords are not translated, regardless of thelocale.

    Date data is written to the file using the standard short date format recognized by your system. When either the date or the time component is missing or zero, only the part provided gets written to the file.

    Nothing is written to the file if outputlist data isEmpty. However, if outputlist data isNull, Null is written to the file.

    For Error data, the output appears as Error errorcode. The Error keyword is not translated regardless of the locale.

    All data written to the file using Print # is internationally aware; that is, the data is properly formatted using the appropriate decimal separator.

    Because Print # writes an image of the data to the file, you must delimit the data so it prints correctly. If you use Tab with no arguments to move the print position to the next print zone, Print # also writes the spaces between print fields to the file.

    Note If, at some future time, you want to read the data from a file using the Input # statement, use the Write # statement instead of the Print # statement to write the data to the file. Using Write # ensures the integrity of each separate data field by properly delimiting it, so it can be read back in using Input #. Using Write # also ensures it can be correctly read in any locale.
    J'ai VB en anglais, chez moi. Que veux-tu? J'habite en Amérique!

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2007
    Messages : 73
    Par défaut
    f1???? et quand on a pas VB installé???

    je suis sous c++builder5 et on m'a demandé de traduire un code VB en C++ (je suis developpeur Java!! Allez comprendre )

    et cette ligne ci??

    Set MyResult = MyDB.OpenRecordset(Query, dbOpenSnapshot, dbSQLPassThrough)

    pourriez vous m'expliquer un peu les différentes etapes..

  6. #6
    Membre émérite
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 730
    Par défaut
    Citation Envoyé par bogizo
    f1???? et quand on a pas VB installé???
    MSDN en ligne, tu as des liens partout sur ce site

    Citation Envoyé par bogizo
    je suis sous c++builder5 et on m'a demandé de traduire un code VB en C++ (je suis developpeur Java!! Allez comprendre )
    Mais tu sais quand même coder en C++ ? car on peut bien commenter le code VB mais pas te le pondre en C++, d'ailleurs il n'est pas assez complet pour le faire.

    Aller je m'y colle 5 minutes, mais aidez-moi les gars, j'ai pas que ça à faire

    et le début...

    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
    29
    30
    31
     
    ' UCase = fonction UpperCase 
    ' elle sort d'où la table "table" ?
    tablename = UCase(table.Name)
    ' écriture dans le fichier log ouvert sous le numéro #FileLog de la chaine de caractère "I:Find..."
      Print #FileLog, "I:Find table '" + tablename + "' from universe '" + strFileList(intN) + "'"
    ' Requête SQL
      Query = "select * from hdd12 a ,hdd13 b where a.GRPNUM= b.GRPNUM and b.IDTENT = a.IDTENT and lower(b.IDTENT) = '" + LCase(tablename) + "' and b.IDTSOC = '" + MltSocForm.numsoctxt.Text + "' "
    ' Ouverture d'un recordset basé sur la requête précédente
      Set MyResult = MyDB.OpenRecordset(Query, dbOpenSnapshot, dbSQLPassThrough)
      DoEvents
    ' Si il y a des résultats
    ' EOF = End Of File
      If (Not MyResult.EOF) Then
         ' Si le nom de la table est différent
         If (LCase(table.Name) <> LCase(MyResult!PHYNAM)) Then 'LCase = LowerCase
                ' changement du nom de la table définie on ne sait où
                ' MyResult!PHYNAM => recordset!nomduchamp
                table.Name = MyResult!PHYNAM
                ' en cas d'erreur on log
                If Err.Number <> 0 Then
                     Print #FileLog, "E:Error while change tables names from '" + tablename + "' to '" + MyResult!PHYNAM + "' (" + Str(Err.Number) + " " + Err.Description + ")"
                Else
                ' sinon on log le changement du nom de la table  
                     Print #FileLog, "I:Changing table from '" + tablename + "' to '" + MyResult!PHYNAM + "'"
                End If
          End If
       Else
          ' la table n'a pas été trouvée
          Print #FileLog, "E:Table '" + tablename + "' Not found in the data dictionary !!"
       End If
    et la suite ?

  7. #7
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2007
    Messages : 73
    Par défaut
    J'ai des bases en C.. et des bases en VB mais qui datent...

  8. #8
    Membre Expert Avatar de OhMonBato
    Homme Profil pro
    Inscrit en
    Mars 2007
    Messages
    2 660
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Morbihan (Bretagne)

    Informations professionnelles :
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2007
    Messages : 2 660
    Par défaut
    Je suis pas sûr qu'il ait VB... ça sent plutôt le besoin de traduction VB --> C++

    Par contre bogizo, t'es pas obligé d'ouvrir un nouveau sujet. Poser la question une seule fois devrait suffire.

  9. #9
    Membre Expert Avatar de OhMonBato
    Homme Profil pro
    Inscrit en
    Mars 2007
    Messages
    2 660
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Morbihan (Bretagne)

    Informations professionnelles :
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2007
    Messages : 2 660
    Par défaut
    Plutot que de mettre les lignes une par une, tu ferais mieux de mettre tout d'un coup (utilises les balises code stp, l'icone # au dessus de la zone de rédaction du message) et si tu as du bol, tu trouveras quelqu'un qui pourra t'aider.

  10. #10
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2007
    Messages : 73
    Par défaut
    je sais c pour ca que je l'ai fait mais personne ne repondant sur l'autre post.. et pour ne pas faire un post a chaque question.....

  11. #11
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2007
    Messages : 73
    Par défaut
    ok voila le code

    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
    tablename = UCase(table.Name)
      Print #FileLog, "I:Find table '" + tablename + "' from universe '" + strFileList(intN) + "'"
      Query = "select * from hdd12 a ,hdd13 b where a.GRPNUM= b.GRPNUM and b.IDTENT = a.IDTENT and lower(b.IDTENT) = '" + LCase(tablename) + "' and b.IDTSOC = '" + MltSocForm.numsoctxt.Text + "' "
      Set MyResult = MyDB.OpenRecordset(Query, dbOpenSnapshot, dbSQLPassThrough)
      DoEvents
      If (Not MyResult.EOF) Then
         If (LCase(table.Name) <> LCase(MyResult!PHYNAM)) Then
                table.Name = MyResult!PHYNAM
                If Err.Number <> 0 Then
                     Print #FileLog, "E:Error while change tables names from '" + tablename + "' to '" + MyResult!PHYNAM + "' (" + Str(Err.Number) + " " + Err.Description + ")"
                Else
                     Print #FileLog, "I:Changing table from '" + tablename + "' to '" + MyResult!PHYNAM + "'"
                End If
          End If
       Else
          Print #FileLog, "E:Table '" + tablename + "' Not found in the data dictionary !!"
       End If
    VOus croyez que c'est grave??

  12. #12
    Membre émérite
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 730
    Par défaut
    Print = instruction d'écriture
    #FileLog = n° du fichier ouvert
    le reste = la ligne inscrite dans le fichier

    ça doit pas être bien dur en C++

Discussions similaires

  1. numéro de ligne java log
    Par need2learn dans le forum Logging
    Réponses: 5
    Dernier message: 17/07/2009, 17h39
  2. lignes suspectes dans un log de firewall
    Par Taka's tiger dans le forum Sécurité
    Réponses: 5
    Dernier message: 07/05/2007, 15h59
  3. Snapshot log et ordre des lignes
    Par orafrance dans le forum Administration
    Réponses: 8
    Dernier message: 15/02/2007, 19h48
  4. Ajouter des lignes dans un fichier *.log
    Par Fred2209 dans le forum C++Builder
    Réponses: 4
    Dernier message: 15/12/2006, 15h15

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo