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

C++ Discussion :

Problème et AVC : _wfopen_s


Sujet :

C++

  1. #121
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 139
    Points : 12 239
    Points
    12 239
    Par défaut
    Oui, mais avec une copie d'écran, on pourra voir ce qui manque pour ce que vous puissiez utiliser un débogueur sur un projet qui compile.

  2. #122
    Nouveau Candidat au Club Avatar de Laurent_B_
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2021
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Avril 2021
    Messages : 512
    Points : 0
    Points
    0
    Par défaut
    cinema.cpp
    D:\Work\Prg\CPP\You\cinema.cpp(1263,18): error C4996: 'std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\codecvt(440,1): message : voir la déclaration de 'std::codecvt_utf8_utf16'
    D:\Work\Prg\CPP\You\cinema.cpp(1263,2): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xlocbuf(302,1): message : voir la déclaration de 'std::wstring_convert'
    D:\Work\Prg\CPP\You\cinema.cpp(1263): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::__autoclassinit2': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\cinema.cpp(1263,56): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::wstring_convert': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\cinema.cpp(1265,19): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::from_bytes': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    erreur_ok.cpp
    ok_txt.cpp
    D:\Work\Prg\CPP\You\ok_txt.cpp(77,21): error C4996: 'std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\codecvt(440,1): message : voir la déclaration de 'std::codecvt_utf8_utf16'
    D:\Work\Prg\CPP\You\ok_txt.cpp(77,5): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xlocbuf(302,1): message : voir la déclaration de 'std::wstring_convert'
    D:\Work\Prg\CPP\You\ok_txt.cpp(77): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::__autoclassinit2': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\ok_txt.cpp(77,59): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::wstring_convert': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\ok_txt.cpp(78,24): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::from_bytes': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\ok_txt.cpp(113,21): error C4996: 'std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\codecvt(440,1): message : voir la déclaration de 'std::codecvt_utf8_utf16'
    D:\Work\Prg\CPP\You\ok_txt.cpp(113,5): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xlocbuf(302,1): message : voir la déclaration de 'std::wstring_convert'
    D:\Work\Prg\CPP\You\ok_txt.cpp(113): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::__autoclassinit2': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\ok_txt.cpp(113,59): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::wstring_convert': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\ok_txt.cpp(114,24): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::from_bytes': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\ok_txt.cpp(698,21): error C4996: 'std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\codecvt(440,1): message : voir la déclaration de 'std::codecvt_utf8_utf16'
    D:\Work\Prg\CPP\You\ok_txt.cpp(698,5): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xlocbuf(302,1): message : voir la déclaration de 'std::wstring_convert'
    D:\Work\Prg\CPP\You\ok_txt.cpp(698): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::__autoclassinit2': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\ok_txt.cpp(698,50): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::wstring_convert': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\ok_txt.cpp(701,38): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::to_bytes': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    D:\Work\Prg\CPP\You\ok_txt.cpp(703,40): error C4996: 'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>,wchar_t,std::allocator<wchar_t>,std::allocator<char>>::from_bytes': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
    serie.cpp
    you_txt.cpp
    Génération de code en cours...
    ???

  3. #123
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 379
    Points : 41 572
    Points
    41 572
    Par défaut
    warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality.
    Oh les connards. Ils ont carrément retiré des fonctionnalités du C++ sans donner d'équivalent.

    Le plus simple pour faire taire le compilo est de rajouter #define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING avant tes includes, mais j'ignore si "faire taire le compilo" est l'action appropriée ici.
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  4. #124
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 139
    Points : 12 239
    Points
    12 239
    Par défaut
    Ok, ce que vous avez posté, c'est les traces de compilations, et c'est bien.
    On sait que "cinema.cpp" et "ok_txt.cpp" contiennent des "warnings", potentielles erreurs mais qui ne bloquent pas la compilation (on verra ça après).
    On sait que "erreur_ok.cpp", "serie.cpp" et "you_txt.cpp" compilent sans problème.

    Génération de code en cours...
    Il n'a pas encore terminé la compilation ou il fait l'édition de lien.

    Il n'y a pas un message après qui indique que tout c'est bien fini ?

    Si toute la compilation/édition de lien c'est bien fini, cela a créé un .exe.

    Je donne une copie d'écran sur un vieux Visual Studio :
    Nom : Pour AVC.png
Affichages : 380
Taille : 43,4 Ko
    Cerclé en rouge, le bouton dans la bare de commande pour lancer le débogueur attaché à l'exécutable généré par le projet de démarrage actuel.
    Cerclée en vert, l'entré de menu pour lancer le débogueur attaché ...
    le raccourci clavier "F5", cerclé en vert dans l'entré de menu cerclée en vert du menu "Déboguer", indique que vous pouvez lancer le débogueur juste en appuyant sur la touche "F5" du clavier.

    Les cercles bleu qui entourent les points rouges indiquent les points d'arrêt actifs pour que le déboguer si arrêt.
    Vous pouvez cliquer dans la colonne verticale grise pour y ajouter un point d'arrêt. (cliquez sur le point rouge pour supprimer le point d'arrêt)

    EDIT :
    Citation Envoyé par Médinoc Voir le message
    Oh les connards. Ils ont carrément retiré des fonctionnalités du C++ sans donner d'équivalent.

    Le plus simple pour faire taire le compilo est de rajouter #define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING avant tes includes, mais j'ignore si "faire taire le compilo" est l'action appropriée ici.
    Ouais, bof, c'est le genre de décision qu'on prend au niveau du projet en entier :
    Nom : Pour AVC2.png
Affichages : 375
Taille : 18,3 Ko

  5. #125
    Nouveau Candidat au Club Avatar de Laurent_B_
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2021
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Avril 2021
    Messages : 512
    Points : 0
    Points
    0
    Par défaut
    Ok, ce que vous avez posté, c'est les traces de compilations, et c'est bien.
    On sait que "cinema.cpp" et "ok_txt.cpp" contiennent des "warnings", potentielles erreurs mais qui ne bloquent pas la compilation (on verra ça après).
    On sait que "erreur_ok.cpp", "serie.cpp" et "you_txt.cpp" compilent sans problème.

    Génération de code en cours...
    Il n'a pas encore terminé la compilation ou il fait l'édition de lien.

    Il n'y a pas un message après qui indique que tout c'est bien fini ?

    Si toute la compilation/édition de lien c'est bien fini, cela a créé un .exe.

    Je donne une copie d'écran sur un vieux Visual Studio :
    Ok, merci beaucoup

    Mais :
    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
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    wstring utf8_to_utf16(const string& utf8)
    {
        vector<unsigned long> unicode;
        size_t i = 0;
        while (i < utf8.size())
        {
            unsigned long uni;
            size_t todo;
            bool error = false;
            unsigned char ch = utf8[i++];
            if (ch <= 0x7F)
            {
                uni = ch;
                todo = 0;
            }
            else if (ch <= 0xBF)
            {
                throw logic_error("not a UTF-8 string");
            }
            else if (ch <= 0xDF)
            {
                uni = ch & 0x1F;
                todo = 1;
            }
            else if (ch <= 0xEF)
            {
                uni = ch & 0x0F;
                todo = 2;
            }
            else if (ch <= 0xF7)
            {
                uni = ch & 0x07;
                todo = 3;
            }
            else
            {
                throw logic_error("not a UTF-8 string");
            }
            for (size_t j = 0; j < todo; ++j)
            {
                if (i == utf8.size())
                    throw logic_error("not a UTF-8 string");
                unsigned char ch = utf8[i++];
                if (ch < 0x80 || ch > 0xBF)
                    throw logic_error("not a UTF-8 string");
                uni <<= 6;
                uni += ch & 0x3F;
            }
            if (uni >= 0xD800 && uni <= 0xDFFF)
                throw logic_error("not a UTF-8 string");
            if (uni > 0x10FFFF)
                throw logic_error("not a UTF-8 string");
            unicode.push_back(uni);
        }
        wstring utf16;
        for (size_t i = 0; i < unicode.size(); ++i)
        {
            unsigned long uni = unicode[i];
            if (uni <= 0xFFFF)
            {
                utf16 += (wchar_t)uni;
            }
            else
            {
                uni -= 0x10000;
                utf16 += (wchar_t)((uni >> 10) + 0xD800);
                utf16 += (wchar_t)((uni & 0x3FF) + 0xDC00);
            }
        }
        return utf16;
    }
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    wstring_convert<codecvt_utf8_utf16<wchar_t>, wchar_t> convert;
    wstring P = convert.from_bytes(lignes);
    Pas évident !

  6. #126
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 139
    Points : 12 239
    Points
    12 239
    Par défaut
    Le premier code est l'implémentation d'une fonction "wstring utf8_to_utf16(const string& utf8)", qui porte pour une fois un nom correct.
    C'est une fonction qui convertie une chaîne de caractère encodée en UTF-8 vers une chaîne de caractère encodé en UTF-16.

    L'implémentation de la fonction me semble correcte, mais c'est le genre de code que j'essaye d'éviter et de voir si la STL la fournit "clé en main".
    Et je pense que c'est ce que fait la classe "codecvt_utf8_utf16".

    Donc, le second code est donc un appel à une implémentation de la STL d'un convertisseur UTF-8=>UTF-16, sans avoir à utiliser une méthode comme "wstring utf8_to_utf16(const string& utf8)".

  7. #127
    Nouveau Candidat au Club Avatar de Laurent_B_
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2021
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Avril 2021
    Messages : 512
    Points : 0
    Points
    0
    Par défaut
    L'implémentation de la fonction me semble correcte, mais c'est le genre de code que j'essaye d'éviter et de voir si la STL la fournit "clé en main".
    Et je pense que c'est ce que fait la classe "codecvt_utf8_utf16".
    Que faire ?
    Merci d'avange

  8. #128
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 139
    Points : 12 239
    Points
    12 239
    Par défaut
    Ne pas se servir de "utf8_to_utf16" mais de "codecvt_utf8_utf16" à la place.

  9. #129
    Nouveau Candidat au Club Avatar de Laurent_B_
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2021
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Avril 2021
    Messages : 512
    Points : 0
    Points
    0
    Par défaut
    Bonjour à tous,

    Goto : J'ai cherche mais pas de solution ! S'il te plait ?
    const int Console_Lire_txt(wstring Textes, int y1, int y2)
    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
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    const int Console_Lire_txt(wstring Textes, int y1, int y2)
    {
    #if Console_Lire_txt_OK_ == 1
        wcout << L"const int Console_Lire_txt(" << Textes << L", " << y1 << L", " << y2 << L") : " << endl;
    #endif
     
        if (Textes == L"" && Y == 0)
            return 0;
        rtrim(Textes);
        //
        bool ligne_vide = false;
        bool retrait = false;
        wchar_t entree = L'\n';
     
        int I, y;
        int i, j, k, n = 0;
        int l, m;
        basic_string <int>::size_type N;
        // // // //  //
        Textes += entree;
        // // // //  //
        int p = 0;
        vector<wstring> P;
        vector<int> PP;
        wstring o;
        int oo = 0;
        N = Textes.length();
        i = 0;
        while (i < N)
        {
            if (Textes[i] == L'\x1b')
            {
                j = i;
                o = L'\x1b';
                j++;
                while (Textes[j] != L'm' || j >= N)
                {
                    o += Textes[j];
                    j++;
                }
                if (j >= N)
                {
                    E.afficher_X(-1, L"::Console_Lire_txt()", L"j >= N !!!");
                    return -1;
                }
                o += L'm';
                P.push_back(o);
                PP.push_back(i);
                Textes = Textes.replace(i, o.length(), L"");
                p++;
                N = Textes.length();
            }
            i++;
        }
        vector <wstring>::iterator iter;
        wstring wstr;
        y = y1;
        I = Y - y;
        j = 0;
        if (I < N)
            n = I;
        else
            n = (int)N;
        vector <int>::iterator iter2;
        iter = P.begin();
        iter2 = PP.begin();
        oo = 0;
        while (j < N)
        {
            // Ok
            if (Textes[j] == entree && retrait == true)
            {
                ligne_vide = true;
                retrait = true;
                goto _ok_;
            }
            // Ok
            for (i = 0; i < y; i++)
    #if Console_Lire_txt_ == 1
                wcout << L'_';
    #else
                wcout << L' ';
    #endif
            // Ok
            while (Textes[j] == L' ')
            {
                j++;
                n++;
                if (n > N)
                    n = (int)N;
            }
            // Ok
            k = j;
            for (j = k; k < n; k++)
            {
                if (Textes[k] == entree)
                {
                    break;
                }
            }
            if (k != n)
            {
                retrait = true;
                n = k;
            }
            else
            { // ???
                ligne_vide = false;
                retrait = false;
                while (Textes[n] != L' ')
                {
                    n--;
                }
            }
            // Ok
            k = j;
            l = 0;
            for (j = k; k < n; k++)
            {
                if (p != 0 && k == *iter2)
                {
                    o = *iter;
                    wcout << o;
                    wstr = o;
                    iter++;
                    iter2++;
                    oo++;
                }
                wcout << Textes[k];
                l++;
            }
            // Ok
            j = k;
            m = Y - (y + l);
            for (i = 0; i < m; i++)
            {
    #if Console_Lire_txt_ == 1
                wcout << L'*';
    #else
                wcout << L' ';
    #endif
            }
            // Ok
        _ok_:
            if (ligne_vide == true && retrait == true)
            {
                ligne_vide = false;
                j++;
                n++;
                if (n > N)
                    n = (int)N;
                y = y1;
                continue;
            }
            else if (ligne_vide == false && retrait == true)
            {
                retrait = false;
                y = y1;
            }
            else
            {
                ligne_vide = false;
                retrait = false;
                y = y2;
            }
            j = n;
            if (p != 0 && j == *iter2)
            {
                o = *iter;
                wcout << o;
                wstr = o;
                iter++;
                iter2++;
                oo++;
            }
            j++;
            // y ?
            n += (Y - y);
            if (n > N)
            {
                n = (int)N;
            }
        }
        if (p != 0 && PP.back() <= N/*iter == wstr*/ /* && N != *iter2*/)
        {
            wcout << P.back() << endl;
            wstr = P.back();
        }
    #if Console_Lire_txt_OK_ == 1
        wcout << L"const int Console_Lire_txt() : Ok !" << endl;
    #endif
        return EXIT_SUCCESS;
    }
    Merci pour tout !

  10. #130
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 139
    Points : 12 239
    Points
    12 239
    Par défaut
    Code très difficile à lire, très proche du C archaïque (variables créées beaucoup trop top, non utilisation des structures de codage récentes plus explicites (rage-loop, etc ...), utilisation de gotos, etc...)
    Il est, même pour du C old-school, très mal écrit, car le nommage des variables et leur "recyclage" sont abscons. Et c'est sans compter les champs ou globales qui sont utilisés à l'arrache pour faire de l'effet de bord imbitable (Y et consort).

    Comme d'habitude, le nom de la fonction ne reflète en rien ce qu'elle fait.

    Cette fonction fait, vraisemblablement, de l'affichage d'un texte "formaté" dans une console "Windows" (non VTxxx).
    Mais le nombre de séquence d'échappement géré est rachitique, l'implémentation, avec des noms de variable débilement courts, invérifiable, etc...

    Dans cette files de messages, quelqu'un avait mis un lien vers l'infrastructure Windows qui permet d'émuler des console VTxxx, utilisez cela au lieu de ré-implémenter une ignoble roue carrée.

    Donc, si vous le pouvez, n'utiliser pas cette horreur mais l'infrastructure d'émulation des VTxxx sous Windows.

    Si vous voulez vraiment comment ce machin fonction, utilisez le débogueur en mode "pas à pas" pour dérouler ce que ce cauchemar fait. Mais il y a fort à parier que c'est truffé de bugs.

  11. #131
    Nouveau Candidat au Club Avatar de Laurent_B_
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2021
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Avril 2021
    Messages : 512
    Points : 0
    Points
    0
    Par défaut
    Merci
    Donc, si vous le pouvez, n'utiliser pas cette horreur mais l'infrastructure d'émulation des VTxxx sous Windows.
    Ok ! Ou est t'il ? https:\\...

    Merci d'avance

  12. #132
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 139
    Points : 12 239
    Points
    12 239
    Par défaut
    Citation Envoyé par Médinoc Voir le message
    Il me semble qu'il y a eu des améliorations de la console pour apporter le support des séquences d'échappement, mais je n'ai plus les détails.
    Cette série d'articles en anglais peut aider:
    https://devblogs.microsoft.com/comma...onsole-conpty/

  13. #133
    Nouveau Candidat au Club Avatar de Laurent_B_
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2021
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Avril 2021
    Messages : 512
    Points : 0
    Points
    0

  14. #134
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 139
    Points : 12 239
    Points
    12 239
    Par défaut
    Utiliser l'API "ConPTY" plutôt que l'API Console "de base" (wout et consort).

    Si votre environnement de développement est à jour (Windows SDK, etc...), c'est juste utiliser des WriteFie à la place des wout. (après avoir appelé les primitives de l'API ConPTY pour correctement se connecter à une "vraie" console").

  15. #135
    Nouveau Candidat au Club Avatar de Laurent_B_
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2021
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Avril 2021
    Messages : 512
    Points : 0
    Points
    0
    Par défaut
    Ok : Noté "WriteFile" !

    Mais :
    Visual c++ 2022 -> Projet -> Propriétés de You -> Propriétés de configuration -> Général
    et :
    you /t s "e:\Séries.[]\The Midnight Club.[2022 Netflix]"

    Ou est t'il ?

    Merci pour tous

  16. #136
    Nouveau Candidat au Club Avatar de Laurent_B_
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2021
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Avril 2021
    Messages : 512
    Points : 0
    Points
    0
    Par défaut
    Mais :
    Visual c++ 2022 -> Projet -> Propriétés de You -> Propriétés de configuration -> Général
    et :
    you /t s "e:\Séries.[]\The Midnight Club.[2022 Netflix]"

    Ou est t'il ?
    Ok ! Terminer !

  17. #137
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 139
    Points : 12 239
    Points
    12 239
    Par défaut
    Ou est t'il ?
    De quel "il" parle-t-on ?

    Mais :
    Visual c++ 2022 -> Projet -> Propriétés de You -> Propriétés de configuration -> Général
    Sur mon vieux VS2017 :
    Nom : Pour AVC3.png
Affichages : 320
Taille : 36,6 Ko
    De quelle option/rubrique (entourées en rouge) parle-t-on ?

    et :
    you /t s "e:\Séries.[]\The Midnight Club.[2022 Netflix]"
    ???
    Ca a la tête d'une commande pour lancer une session de débogage.

    Pour configurer le débogueur avec ce type de commande, faut juste aller à côté du chemin que vous avez signalé dans votre dernier message, au lieu d'aller dans "Général", allez dans "Débogage" (cercle rouge dans l'écran suivant :
    Nom : Pour AVC4.png
Affichages : 322
Taille : 27,3 Ko

    Normalement, la rubrique "Commande" doit être "$(TargetPath)", ce qui doit convenir à la très grande majorité des cas.
    Dans votre projet, cela doit être évalué à un truc comme le chemin vers votre exécutable "you.exe".
    Pour que '/t s "e:\Séries.[]\The Midnight Club.[2022 Netflix]"' soit ajouté en tant que paramètre de lancement de votre exécutable, lors de son lancement par le débogueur, je vous conseille de l'ajouter dans la rubrique "Arguments de la commande" (entourée en vert dans l'image précédente).

    Pour les ajouter, cliquez sur le menu déroulant de la rubrique (cercle rouge sur l'image de l'écran suivante), puis sur "<Modifier ...>" (cercle rouge sur l'image de l'écran suivante)
    Nom : Pour AVC5.png
Affichages : 318
Taille : 6,7 Ko

    Puis d'ajouter les arguments de la ligne de commande :
    Nom : Pour AVC6.png
Affichages : 316
Taille : 28,8 Ko

  18. #138
    Nouveau Candidat au Club Avatar de Laurent_B_
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2021
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Avril 2021
    Messages : 512
    Points : 0
    Points
    0
    Par défaut
    Merci pour tous

  19. #139
    Nouveau Candidat au Club Avatar de Laurent_B_
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2021
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Avril 2021
    Messages : 512
    Points : 0
    Points
    0
    Par défaut
    Bonjour,

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    DWORD dwMode = 0;
    CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
    /* */
    wchar_t str[] = L"L'example texte àçéè…\r\n";
    WriteFile(
            hOut /*HANDLE hOut*/,
            str, 
            wcslen(str),
            &dwMode /*dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;*/,
            NULL); /* <=== Attention !!! */
    Gravité Code Description Projet Fichier Ligne État de la suppression
    Avertissement C4267 'argument'*: conversion de 'size_t' en 'DWORD', perte possible de données You D:\Work\Prg\CPP\You\You.cpp 980
    et :
    L'example teConst int You_t(int& c, wchar_t**) :
    Que faire ?

    Merci d'avance

  20. #140
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 139
    Points : 12 239
    Points
    12 239
    Par défaut
    Comme vous utilisez des API qui utilisent des chaines de caractère multi-octets (utilisation de la MACRO L, de wchar_t, de wcslen, etc...), je vous conseille d'utiliser systématiquement les versions "W" des primitives de Win32.
    Donc, si possible "WriteFileW" à la place de "WriteFile".

    Gravité Code Description Projet Fichier Ligne État de la suppression
    Avertissement C4267 'argument'*: conversion de 'size_t' en 'DWORD', perte possible de données You D:\Work\Prg\CPP\You\You.cpp 980
    Pour les messages d'erreur, préférez prendre les messages directement dans la console de trace d'exécution de la chaîne de compilation que le résumé dans le tableau de synthèse de la compilation (moins précis).

    "Avertissement C4267" : C'est un warning/Avertissement, donc, normalement, cela ne bloque pas la génération de l'exécutable, mais c'est toujours bien de les traiter le plus tôt possible.

    Je pense que la ligne 980 est "wcslen(str),", et ici, c'est un peu de friction entre votre code qui est en C++ ( wcslen fait partie de la STL du C++) et l'API Win32 de Windows qui est une API C, et non C++.

    L'API C "WriteFile" demande un DWORD (type spécifique aux APIs Windows, il me semble) en 3ème paramètre, or, wcslen renvoie un "size_t", type C++ qui peut potentiellement contenir des nombres plus grand que la valeur maximum de DWORD.

    Ici, dans votre code, où la chaîne de caractère dans la variable "str" est petite et connue à l'avance, vous pouvez légitimement caster le résultat de wcslen :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    WriteFile(
            hOut /*HANDLE hOut*/,
            str, 
            (DWORD)wcslen(str),
            &dwMode /*dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;*/,
            NULL);
    Une manière simple de résoudre "définitivement" ce type de problème, c'est de faire un "wrapper" C++ autour des APIs C, pour factoriser le code de "conversion".

    L'example teConst int You_t(int& c, wchar_t**) :
    Quelle est la question ?
    Sinon, on évite les pointeurs nus, "wchar_t*", mais encore plus les pointeurs de pointeurs "wchar_t**", SVP.

+ Répondre à la discussion
Cette discussion est résolue.
Page 7 sur 40 PremièrePremière ... 3456789101117 ... DernièreDernière

Discussions similaires

  1. Probléme avc la formclosing
    Par dv-2008 dans le forum VB.NET
    Réponses: 2
    Dernier message: 23/03/2008, 16h33
  2. probléme avc console.readline()
    Par dv-2008 dans le forum VB.NET
    Réponses: 7
    Dernier message: 10/03/2008, 00h33
  3. j'ai un probléme avc un code vb.net aider moi svp
    Par dv-2008 dans le forum VB.NET
    Réponses: 12
    Dernier message: 29/01/2008, 09h20
  4. Problème avc une requête
    Par Raiga dans le forum Requêtes et SQL.
    Réponses: 3
    Dernier message: 30/06/2007, 18h36
  5. Toujours problème de lien avce la lib Cblas
    Par Kirou dans le forum Autres éditeurs
    Réponses: 1
    Dernier message: 19/06/2007, 14h50

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