In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about how to read and write files in C++ Builder. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
When programming in C++, the manipulation of code files is a common problem. In C++ Builder, you can use a variety of methods to manipulate files. Here is a detailed description of this in C++ Builder according to the following sections, and the following are listed one by one:
1. File operation based on C #
2. File manipulation based on C++
3. File operation based on WINAPI
4. File operation based on BCB library
5. The operation of special files.
In ANSIC, there are two ways to manipulate files, that is, streaming file operation and Imax O file operation, which are described below.
1) streaming file operation
There is an important structure for file manipulation in this way: FILE,FILE is defined in stdio.h as follows:
Typedef struct {int level; / * fill/empty level of buffer * / unsigned flags; / * File status flags * / char fd; / * File descriptor * / unsigned char hold; / * Ungetc char if no buffer * / int bsize; / * Buffer size * / unsigned char _ FAR * buffer; / * Data transfer buffer * / unsigned char _ FAR * curp; / * Current active pointer * / unsigned istemp; / * Temporary file indicator * / short token; / * Used for validity checking * /} FILE / * This is the FILE object * /
The C++ Builder structure contains the basic attributes of file operations, and all file operations are performed through the pointer of this structure. Common functions for this kind of file operations are as follows:
Fopen () Open stream fclose () close stream fputc () write a character to stream fgetc () read a character from stream fseek () navigate to specified character fputs () write string to stream fgets () read a line from stream or specify character fprintf () output to stream fscanf () read feof () from stream to file in format Return truth value ferror () return its value rewind () reset file locator to the beginning of the file remove () Delete the file fread () read a specified number of characters fwrite () from the stream to write a specified number of characters tmpfile () generate a temporary file stream tmpnam () generate a * file name above is Xiaobian for everyone to share How to read and write files in C++ Builder If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.