Windows API read-write binary files

Source: Internet
Author: User

In fact, if you have studied C language, use stdio.h directly.

The middle function is the simplest, that is, the use of fopen ("Xxxx.xxx", "RB"); and then call Fread/fwrite; Call Fclose when you close it.

If you use CreateFile in the Windows Native API, you do not need to differentiate what binary is not binary, as long as the return value of this function is not invalid_handle_value, you can continue to use Readfile/writefile To read and write, and then use CloseHandle to close. This is directly an example of "Platform sdk:files and I/O" in MSDN.

Further more, stdio.h in the fopen when the so-called "RB" or "WB" "B" is the binary mode, and the text pattern ("T") is only the difference between parsing 0x0D & 0x0A (carriage return and newline), which is mainly manifested in FGETS/FSC ANF functions such as the function to manipulate strings, in fact, the use of "B" call fopen after the FGETS/FSCANF and other functions are also available. If strings are not involved, "B" and "T" do not have much difference.

What is binary:

The Universal binary program is a package, bundle, and translation bundle, is a Mac OS X system in an application format, is actually a special folder can be directly double-click to run, the folder contains the main program, a variety of resources, documents and help files, so that the software in Mac OS X generally do not need to install, Copy to your hard disk and run, and easily localize and internationalize. Carbon and cocoa are application frameworks for the two MAC platforms (similar to MFC, VCL, GTK +, QT, etc.), which are compatible with the Mac OS 8-9 API, so they can generate applications that run on Mac OS Classic and OS X, which can only generate OS X program, but may be able to run on the IBM PowerPC RISC chip and the Intel x86 CISC chip two architectures of the Mac OS X system, that is, the universal binary--Universal binaries. ]?

Windows API read-write binary files

Related Article

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.