- <<InformationFichier.cpp>>
-
-
- #include "stdafx.h"
- #include<iostream>
- #include <string>
- #include <stdio.h>
- #include "wingdi.h"
- using namespace std;
- enum attribute {
- NORMAL = 0x00,
- READONLY = 0x01,
- HIDDEN = 0x02,
- SYSTEM = 0x04,
- VOLUME = 0x08,
- DIRECTORY = 0x10,
- ARCHIVE = 0x20
- };
-
- string Getattribut(char str);
- int main(int argc, char* argv[])
- {
- OPENFILENAME Selection;
- char Chemin[200];
- char Fichier[50];
-
- memset(&Selection,0,sizeof(Selection));
-
- Selection.lStructSize =sizeof(OPENFILENAME);
- Selection.hwndOwner=NULL;
- Selection.hInstance=NULL;
-
- Selection.lpstrFilter=
- TEXT("Fichiers *.*\0*.*\0\0");
-
- Selection.lpstrCustomFilter=NULL;
- Selection.nMaxCustFilter=1;
- Selection.nFilterIndex=1;
- Selection.lpstrFile=Chemin;
- Selection.nMaxFile=sizeof(Chemin);
- Selection.lpstrFileTitle=Fichier;
- Selection.nMaxFileTitle=sizeof(Fichier)-1;
- Selection.lpstrInitialDir = NULL;
- Selection.lpstrTitle="choisir un fichier";
- Selection.Flags=OFN_FILEMUSTEXIST;
- Selection.Flags=OFN_CREATEPROMPT;
- Selection.lpstrDefExt =NULL;
- Selection.lCustData=NULL;
- Selection.lpfnHook=NULL;
- Selection.lpTemplateName=NULL;
- Chemin[0]='\0';
- GetOpenFileName(&Selection);
- if (Chemin!='\0'){
- CFile file;
- CFileException e;
- CFileStatus status;
- file.Open(Chemin,CFile::modeRead, &e);
- file.GetStatus( Chemin, status );
-
- cout<<"Chemin : "<<status.m_szFullName<<endl;
- cout<<"///////////////////////////////////"<<endl;
- cout<<"Taille en Octets :"<<status.m_size<<endl;
- cout<<"///////////////////////////////////"<<endl;
- cout<<"Atribut : "<<Getattribut(status.m_attribute)<<endl;
- cout<<"///////////////////////////////////"<<endl;
- cout<<"Fichier cree le : "<<status.m_ctime.GetDay()<<"/"<<status.m_ctime.GetMonth()<<"/"<<status.m_ctime.GetYear()<<endl ;
- cout<<"///////////////////////////////////"<<endl;
- cout<<"Fichier cree a : "<<status.m_ctime.GetHour() <<":"<<status.m_ctime.GetMinute()<<":"<<status.m_ctime.GetSecond()<<endl ;
- cout<<"///////////////////////////////////"<<endl;
-
-
- char pbuf[100];
- UINT nBytesRead = file.Read( pbuf, 100 );
-
- file.Close();
- }
- return 0;
- }
-
- string Getattribut(char str)
- {
- string attr1;
- string attr2;
- switch (str&0x0f)
- {
- case NORMAL:
- attr1="normal";
- break;
-
- case READONLY:
- attr1="lecture seule ";
- break;
-
- case HIDDEN:
- attr1="cache";
- break;
-
- case SYSTEM:
- attr1="system";
- break;
-
- case VOLUME:
- attr1="volume";
- break;
- case HIDDEN+READONLY:
- attr1=" cache + lecture seule ";
- break;
- case HIDDEN +SYSTEM:
- attr1=" cache+systeme";
- break;
- case HIDDEN +VOLUME:
- attr1=" cache + volume";
- break;
- case SYSTEM +VOLUME:
- attr1=" systeme + volume";
- break;
- case HIDDEN + SYSTEM +VOLUME+READONLY:
- attr1=" cache + systeme + volume + lecture seule";
- break;
- case HIDDEN + SYSTEM +VOLUME:
- attr1="cache + systeme + volume";
- break;
-
-
- }
- switch (str&0xf0)
- {
- case DIRECTORY:
- attr2="repertoire";
- break;
-
- case ARCHIVE:
- attr2="archive";
- break;
- }
-
- return attr1+" + " +attr2;
- }
-
-
- <<stdafx.h>>
-
- // stdafx.h : include file for standard system include files,
- // or project specific include files that are used frequently, but
- // are changed infrequently
- //
-
- #if !defined(AFX_STDAFX_H__080A3C04_6281_11D6_AEA2_0080C8DFB15E__INCLUDED_)
- #define AFX_STDAFX_H__080A3C04_6281_11D6_AEA2_0080C8DFB15E__INCLUDED_
-
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include <afxwin.h> // MFC core and standard components
- #include <afxext.h> // MFC extensions
- #include <afxdisp.h> // MFC Automation classes
- #include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
-
- // TODO: reference additional headers your program requires here
-
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-
- #endif // !defined(AFX_STDAFX_H__080A3C04_6281_11D6_AEA2_0080C8DFB15E__INCLUDED_)
-
<<InformationFichier.cpp>>
#include "stdafx.h"
#include<iostream>
#include <string>
#include <stdio.h>
#include "wingdi.h"
using namespace std;
enum attribute {
NORMAL = 0x00,
READONLY = 0x01,
HIDDEN = 0x02,
SYSTEM = 0x04,
VOLUME = 0x08,
DIRECTORY = 0x10,
ARCHIVE = 0x20
};
string Getattribut(char str);
int main(int argc, char* argv[])
{
OPENFILENAME Selection;
char Chemin[200];
char Fichier[50];
memset(&Selection,0,sizeof(Selection));
Selection.lStructSize =sizeof(OPENFILENAME);
Selection.hwndOwner=NULL;
Selection.hInstance=NULL;
Selection.lpstrFilter=
TEXT("Fichiers *.*\0*.*\0\0");
Selection.lpstrCustomFilter=NULL;
Selection.nMaxCustFilter=1;
Selection.nFilterIndex=1;
Selection.lpstrFile=Chemin;
Selection.nMaxFile=sizeof(Chemin);
Selection.lpstrFileTitle=Fichier;
Selection.nMaxFileTitle=sizeof(Fichier)-1;
Selection.lpstrInitialDir = NULL;
Selection.lpstrTitle="choisir un fichier";
Selection.Flags=OFN_FILEMUSTEXIST;
Selection.Flags=OFN_CREATEPROMPT;
Selection.lpstrDefExt =NULL;
Selection.lCustData=NULL;
Selection.lpfnHook=NULL;
Selection.lpTemplateName=NULL;
Chemin[0]='\0';
GetOpenFileName(&Selection);
if (Chemin!='\0'){
CFile file;
CFileException e;
CFileStatus status;
file.Open(Chemin,CFile::modeRead, &e);
file.GetStatus( Chemin, status );
cout<<"Chemin : "<<status.m_szFullName<<endl;
cout<<"///////////////////////////////////"<<endl;
cout<<"Taille en Octets :"<<status.m_size<<endl;
cout<<"///////////////////////////////////"<<endl;
cout<<"Atribut : "<<Getattribut(status.m_attribute)<<endl;
cout<<"///////////////////////////////////"<<endl;
cout<<"Fichier cree le : "<<status.m_ctime.GetDay()<<"/"<<status.m_ctime.GetMonth()<<"/"<<status.m_ctime.GetYear()<<endl ;
cout<<"///////////////////////////////////"<<endl;
cout<<"Fichier cree a : "<<status.m_ctime.GetHour() <<":"<<status.m_ctime.GetMinute()<<":"<<status.m_ctime.GetSecond()<<endl ;
cout<<"///////////////////////////////////"<<endl;
char pbuf[100];
UINT nBytesRead = file.Read( pbuf, 100 );
file.Close();
}
return 0;
}
string Getattribut(char str)
{
string attr1;
string attr2;
switch (str&0x0f)
{
case NORMAL:
attr1="normal";
break;
case READONLY:
attr1="lecture seule ";
break;
case HIDDEN:
attr1="cache";
break;
case SYSTEM:
attr1="system";
break;
case VOLUME:
attr1="volume";
break;
case HIDDEN+READONLY:
attr1=" cache + lecture seule ";
break;
case HIDDEN +SYSTEM:
attr1=" cache+systeme";
break;
case HIDDEN +VOLUME:
attr1=" cache + volume";
break;
case SYSTEM +VOLUME:
attr1=" systeme + volume";
break;
case HIDDEN + SYSTEM +VOLUME+READONLY:
attr1=" cache + systeme + volume + lecture seule";
break;
case HIDDEN + SYSTEM +VOLUME:
attr1="cache + systeme + volume";
break;
}
switch (str&0xf0)
{
case DIRECTORY:
attr2="repertoire";
break;
case ARCHIVE:
attr2="archive";
break;
}
return attr1+" + " +attr2;
}
<<stdafx.h>>
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__080A3C04_6281_11D6_AEA2_0080C8DFB15E__INCLUDED_)
#define AFX_STDAFX_H__080A3C04_6281_11D6_AEA2_0080C8DFB15E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__080A3C04_6281_11D6_AEA2_0080C8DFB15E__INCLUDED_)