File operations under C # WPF application

Source: Internet
Author: User
Tags readfile

Well, the computer sucks, spend a lot of time every day waiting for computer reaction.

No money to buy a new computer, not even a group of desktops. Oh, good.

Oh, ah, what the hell is the file operation??? C + + I am ignorant, C # a lot of things to learn!!! I won't! I won't! I won't!!! Ah ah ah ah Ah!!!

What do you do? Write with Windows API How do I migrate to Linux?

File operations for WINDOWS APIs

A. Common functions

CreateFile Create, open files
ReadFile Read File contents
WriteFile Write file contents
SetFilePointer Move file pointer
SetEndOfFile Set End of File flag
CopyFile File copy
DeleteFile File deletion
MoveFile File move
CreateDirectory Create a Directory
RemoveDirectory Delete a directory
GetCurrentDirectory Get the directory where the current program is located
SetCurrentDirectory Set the directory where the current program is located
FindFirstFile Finds the first file in a specified directory
FindNextFile Find Next file
LockFile File lock
Unlockfile File unlock
Getfiletype Get file type
GetFileSize Get the size of a file
GetFileAttributes Get file properties
SetFileAttributes Setting file properties
Getfiletime Get file time
GetFileInformationByHandle Get file information
Getfullpathname Get the full path to the file
GetModuleFileName Get current module full path

Manual copy of the ice daddy form get√

So the usual input and output operations can be achieved through the Windows built-in API, no longer have to study C + + those who kill thousand knives function, La la la la ~

Two. How to use

Want to get started with Windows API, I first achieve a small goal, such as the first machine code to write a Windows operating system ... No, write a program to manage the files on my disk.

Because my computer sucks, rotten home, not only the speed is not fast enough, and the capacity is very small. So all my packages are logically associative to the backup to the mobile hard drive.

The direct result is that I need to open more than 20 Program_setup folders every day, then the first level to find, I'm going crazy la La la la!!! So decide to write a small program to manage the document yourself.

Program function: Find all the files under the specified path and save the file name, document description, File relative path three information. Create a file directory table to hold all the information.

Program Structure: Backend uses Windows API C + + mode, or C # way, Front end uses WPF application

1. Back-end programs

SEARCH.H-for recursive all files

CatchInfo.h-for reading and saving file information

Store.h-Used to organize stored file information data.

Query.h-For querying tables

Exec.h-Used to perform copy of file, installation operation

Update.h-for updating the installation package files

createfile Create, open file
readfile Read file contents
writefile Write file contents
setfilepointer Move the file pointer
setendoffile Set end of file flag
copyfile file copy
deletefile file Delete
movefile file move
createdirectory Create a directory
removedirectory Delete a directory
getcurrentdirectory Get the directory where the current program is located
setcurrentdirectory Set the directory where the current program is located
findfirstfile Find the first file in a specified directory
findnextfile Find the next file
lockfile file lock
unlockfile file unlock
getfiletype get file type
getfilesize Get the size of the file
getfileattributes Get file properties
setfileattributes Set file properties
getfiletime Get file time
getfileinformationbyhandle Get file information
getfullpathname Get the full path to the file
GetModuleFileName Get current module full path

File operations under C # WPF application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.