b) Write a C/C++ system program to search for a file in the Windows file system and display the file information on the screen. Compile and run the program and copy the source code into your answer booklet.
#include<Windows>
#include<iostream>
using namespace std;
int main(){
//file variable
WIN64_FIND_DATA FindFileData;
HANDLE hFindFIle;
//
LPCWSTR file=L "*.cpp";
//find file function
hFindFIle=FindFirstFile(file,&FindFileData);
if(INVALID_HANDLE_VALUE==hFindFIle){
cout<<"error in finding file"<<endl;
cout<<"Error -"<<GegLastError()<<endl;
}else{
cout<<"error in finding file"<<endl;'
wcout<<
}
return 0;
}
Comments
Leave a comment