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

Visual C++ Discussion :

Refaire une fonction printf personnalis�e


Sujet :

Visual C++

Mode arborescent

Message pr�c�dent Message pr�c�dent   Message suivant Message suivant
  1. #1
    Membre extr�mement actif
    Profil pro
    Inscrit en
    Mai 2011
    Messages
    926
    D�tails du profil
    Informations personnelles :
    Localisation : France, Vienne (Poitou Charente)

    Informations forums :
    Inscription : Mai 2011
    Messages : 926
    Par d�faut Refaire une fonction printf personnalis�e
    Bonjour,

    Ce soir je vais commencer � d�velopper une �mulation de console de Microsoft ;
    ca je sais faire.

    Je voudrais refaire la fonction printf que je vais nommer par exemple "dwprintf" pour pouvoir plus tard afficher du texte dans ma console.
    et ca ne compile pas du tout !

    Comment fait t'on ?????
    Je joint le projet qui utilise pour le moment printf et ca ne compile pas du tout !.

    Merci

    ma fonction � moi ci-dessous qui servira plus tard pour ma console microsoft emuler ;

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    int __cdecl dwsprintf (
            char *string,
            const char *format,
            ...
            )
    {
     
            FILE str;
            REG1 FILE *outfile = &str;
            va_list arglist;
            REG2 int retval;
     
            _VALIDATE_RETURN( (format != NULL), EINVAL, -1);
     
    #ifdef _COUNT_
            _VALIDATE_RETURN( (count == 0) || (string != NULL), EINVAL, -1 );
    #else  /* _COUNT_ */
            _VALIDATE_RETURN( (string != NULL), EINVAL, -1 );
    #endif  /* _COUNT_ */
            va_start(arglist, format);
     
    #ifndef _COUNT_
            outfile->_cnt = MAXSTR;
    #else  /* _COUNT_ */
            if(count>INT_MAX)
            {
                /* old-style functions allow any large value to mean unbounded */
                outfile->_cnt = INT_MAX;
            }
            else
            {
                outfile->_cnt = (int)(count);
            }
    #endif  /* _COUNT_ */
            outfile->_flag = _IOWRT|_IOSTRG;
            outfile->_ptr = outfile->_base = string;
     
            retval = _output_l(outfile,format,NULL,arglist);
     
            if (string == NULL)
                return(retval);
     
    #ifndef _SWPRINTFS_ERROR_RETURN_FIX
            _putc_nolock('\0',outfile); /* no-lock version */
    		printf("%s\n",outfile->_ptr);
     
            return(retval);
    #else  /* _SWPRINTFS_ERROR_RETURN_FIX */
            if((retval >= 0) && (_putc_nolock('\0',outfile) != EOF))
                return(retval);
     
            string[0] = 0;
            return -1;
    #endif  /* _SWPRINTFS_ERROR_RETURN_FIX */
     
    }

    1>e:\source\projet\recherche\resprintf\resprintf.cpp(23) : error C2065: 'REG1' : undeclared identifier
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(23) : error C2146: syntax error : missing ';' before identifier 'FILE'
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(23) : error C2065: 'outfile' : undeclared identifier
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(23) : error C2275: 'FILE' : illegal use of this type as an expression
    1> l:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(69) : see declaration of 'FILE'
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(25) : error C2065: 'REG2' : undeclared identifier
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(25) : error C2144: syntax error : 'int' should be preceded by ';'
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(27) : error C2065: 'EINVAL' : undeclared identifier
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(27) : error C3861: '_VALIDATE_RETURN': identifier not found
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(32) : error C3861: '_VALIDATE_RETURN': identifier not found
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(37) : error C2227: left of '->_cnt' must point to class/struct/union/generic type
    1> type is ''unknown-type''
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(37) : error C2065: 'MAXSTR' : undeclared identifier
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(49) : error C2227: left of '->_flag' must point to class/struct/union/generic type
    1> type is ''unknown-type''
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(50) : error C2227: left of '->_ptr' must point to class/struct/union/generic type
    1> type is ''unknown-type''
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(50) : error C2227: left of '->_base' must point to class/struct/union/generic type
    1> type is ''unknown-type''
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(52) : error C3861: '_output_l': identifier not found
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(58) : error C2227: left of '->_cnt' must point to class/struct/union/generic type
    1> type is ''unknown-type''
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(58) : error C2227: left of '->_ptr' must point to class/struct/union/generic type
    1> type is ''unknown-type''
    1>e:\source\projet\recherche\resprintf\resprintf.cpp(59) : error C2227: left of '->_ptr' must point to class/struct/union/generic type
    1> type is ''unknown-type''

    Merci
    Fichiers attach�s Fichiers attach�s

Discussions similaires

  1. Modification d'une fonction : printf d'un tableau
    Par sloshy dans le forum Langage
    R�ponses: 6
    Dernier message: 15/01/2010, 19h38
  2. [1.x] Hydratation personnalis�e par une fonction g�n�rique
    Par daajack dans le forum Symfony
    R�ponses: 2
    Dernier message: 10/12/2007, 10h50
  3. #Erreur dans une requ�te avec une fonction personnalis�e
    Par pguiheu dans le forum Requ�tes et SQL.
    R�ponses: 9
    Dernier message: 04/07/2006, 15h45
  4. R�ponses: 3
    Dernier message: 21/02/2006, 18h05
  5. R�ponses: 4
    Dernier message: 08/02/2006, 08h31

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