« Discussion:Programmation C++/Les fichiers » : différence entre les versions

Le contenu de la page n’est pas pris en charge dans d’autres langues.
Un livre de Wikilivres.
Contenu supprimé Contenu ajouté
Ligne 15 : Ligne 15 :
::S'il en faut une pour Linux, je propose la suivante: man7.org/linux/man-pages/man3/fopen.3.html
::S'il en faut une pour Linux, je propose la suivante: man7.org/linux/man-pages/man3/fopen.3.html
:::Je n'y vois aucune mention d'encodage ou d'Unicode. [[Utilisateur:JackPotte|JackPotte]] ([[Discussion utilisateur:JackPotte|<font color="#FF6600">$</font>♠]]) 13 février 2016 à 22:59 (CET)
:::Je n'y vois aucune mention d'encodage ou d'Unicode. [[Utilisateur:JackPotte|JackPotte]] ([[Discussion utilisateur:JackPotte|<font color="#FF6600">$</font>♠]]) 13 février 2016 à 22:59 (CET)
::::Pour unicode, je ne sais pas, mais pour ce qui est de l'encodage, je lis:
:::: ''In addition to the above characters, fopen() and freopen() support the following syntax in mode:''
:::: ,ccs=string
:::: ''The given string is taken as the name of a coded character set and the stream is marked as wide-oriented. Thereafter, internal conversion functions convert I/O to and from the character set string. If the ,ccs=string syntax is not specified, then the wide-orientation of the stream is determined by the first file operation. If that operation is a wide-character operation, the stream is marked wide-oriented, and functions to convert to the coded character set are loaded.''

Version du 14 février 2016 à 21:39

Juste un point : les méthodes présentées ici sont du C, pas du C++... quid de ifstream, ofstream et fstream ?

Plus bas dans la page : Programmation C++ (débutant)/Les fichiers#Utilisation de fstream --DavidL 19 juillet 2007 à 19:05 (CEST)[répondre]

Encodage des fichiers textes

La page parle de fichiers textes.

Comment savoir en quel encodage est écrit ce fichier? windows-1252? utf8? utf16? autre? L'article ne le dit pas, alors que cette précision me semble utile, de même en lecture. En fait si l'encodage n’est pas connu, on ne peut pas vraiment parler de fichier texte, dans le sens où il s'agit d'un flux binaire et non d'un flux texte.

Par ailleurs, est-il possible de changer ce codage au besoin?

Je viens de l'ajouter dans un petit paragraphe, n'hésitez pas à le compléter. JackPotte ($) 13 février 2016 à 19:38 (CET)[répondre]
La réf donnée est pour Microsoft.
S'il en faut une pour Linux, je propose la suivante: man7.org/linux/man-pages/man3/fopen.3.html
Je n'y vois aucune mention d'encodage ou d'Unicode. JackPotte ($) 13 février 2016 à 22:59 (CET)[répondre]
Pour unicode, je ne sais pas, mais pour ce qui est de l'encodage, je lis:
In addition to the above characters, fopen() and freopen() support the following syntax in mode:
,ccs=string
The given string is taken as the name of a coded character set and the stream is marked as wide-oriented. Thereafter, internal conversion functions convert I/O to and from the character set string. If the ,ccs=string syntax is not specified, then the wide-orientation of the stream is determined by the first file operation. If that operation is a wide-character operation, the stream is marked wide-oriented, and functions to convert to the coded character set are loaded.