Contacts

Work with data from file c. Working with text files. Reading from binary file and write to it

File I / O operation in C ++ is almost similar to the work of ordinary (but with small nuances).

File I / O Classes

there is three main file I / O classes in C ++:

ofstream (is a daughter class);

fstream (is a subsidiary of iostream).

Using these classes, you can perform a unidirectional file input, unidirectional file output and bidirectional file input / output. To use them, you just need to connect Fstream.

Unlike COUT, CIN, CERR and CLOG streams, which can immediately be used, file streams should be explicitly installed by the programmer. That is, to open a file for reading and / or recording, you need to create an object of the corresponding file input class, specifying the file name as a parameter. Then, using insert operators (<<) или извлечения (>\u003e), you can write data to a file or read the contents of the file. After that, the finals - you need to close the file: explicitly cause close () method Or simply allow the I / O file variable exit from the visibility area (the input / output file class closes this file automatically instead of us).

File output

To write to the file used class ofstream . For example:

#Include. #Include. #Include. // To use EXIT () INT MAIN () (Using Namespace STD; // Ofstream is used to record data into a file // Create a Sometext.txt.txt.Txt. Outf file ("sometext.txt"); // If we cannot open this file to write data to it if (! OUTF) (// then display an error message and perform EXIT () CERR<< "Uh oh, SomeText.txt could not be opened for writing!" << endl; exit(1); } // Записываем в файл следующие две строчки outf << "See line #1!" << endl; outf << "See line #2!" << endl; return 0; // Когда outf выйдет из области видимости, то деструктор класса ofstream автоматически закроет наш файл }

#Include.

#Include.

#Include. // To use EXIT ()

iNT MAIN ()

using Namespace STD;

// OFSTREAM Used to write data to the file

// Create a sometext.txt file

ofstream outf ("sometext.txt");

// If we cannot open this file to write data into it

iff (! OUTF)

// then display an error message and execute EXIT ()

cerr.<< << endl ;

eXIT (1);

// write the following two lines to the file

outf.<< "See line #1!" << endl ;

outf.<< "See line #2!" << endl ;

return 0;

// When OUTF comes out of the visibility area, the destructor of the Ostream class will automatically close our file

If you look into your project directory ( PCM on a tab called your.cpp file in Visual Studio > "Open the folder containing") You will see a file named sometext.txt in which the following lines are:

See Line # 1!
See Line # 2!

Note, we can also use pUT () To write one symbol to the file.

File input

#Include. #Include. #Include. #Include. // To use EXIT () INT MAIN () (Using Namespace STD; // ifstream is used to read the contents of the file // We will try to read the contents of the Sometext.txt button ifstream inf ("sometext.txt"); // if we cannot open This file is to read its contents if (! INF) (CERR<< "Uh oh, SomeText.txt could not be opened for reading!" << endl; exit(1); } // Пока есть данные, которые мы можем прочитать while (inf) { // То перемещаем эти данные в строку, которую затем выводим на экран string strInput; inf >\u003e strinput; Cout.<< strInput << endl; } return 0; }

#Include.

#Include.

#Include.

#Include. // To use EXIT ()

iNT MAIN ()

using Namespace STD;

// ifstream is used to read the contents of the file

// If we cannot open this file to read its contents.

if (! inf)

// then display the following error message and perform EXIT ()

cerr.<< << endl ;

eXIT (1);

// While there is data that we can read

while (INF)

// then move this data to the string, which is then displayed on the screen

string strinput;

iNF \u003e\u003e STRINPUT;

cout.<< strInput << endl ;

return 0;

// When an INF comes out of the scope of visibility, the IFStream class destructor will automatically close our file

See
Line
#1!
See
Line
#2!

Hmm, it's not exactly what we wanted. As we already know from previous lessons, the extraction operator works with "formatted data", i.e. It ignores all spaces, tabs and a new string symbol. To read all the contents as it is, without its breakdown on the part (as in the example above), we need to use gETLINE () method:

#Include. #Include. #Include. #Include. // To use EXIT () INT MAIN () (Using Namespace STD; // ifstream is used to read the contents of files // We will try to read the contents of the Sometext.txt.txt button ifstream inf ("sometext.txt"); // if we cannot Open file to read its contents if (! INF) (// then display the following error message and perform EXIT () CERR<< "Uh oh, SomeText.txt could not be opened for reading!" << endl; exit(1); } // Пока есть, что читать while (inf) { // То перемещаем то, что можем прочитать, в строку, а затем выводим эту строку на экран string strInput; getline(inf, strInput); cout << strInput << endl; } return 0; // Когда inf выйдет из области видимости, то деструктор класса ifstream автоматически закроет наш файл }

#Include.

#Include.

#Include.

#Include. // To use EXIT ()

iNT MAIN ()

using Namespace STD;

// ifstream is used to read the contents of the files

ifstream inf ("sometext.txt");

// If we cannot open the file to read its contents.

if (! inf)

// then display the following error message and perform EXIT ()

cerr.<< "UH OH, Sometext.txt Could Not Be Opened for Reading!"<< endl ;

eXIT (1);

while (INF)

string strinput;

getLine (INF, STRINPUT);

cout.<< strInput << endl ;

return 0;

// When an INF comes out of the scope of visibility, the IFStream class destructor will automatically close our file

The result of the program is higher:

Buffered output

Conclusion in C ++ may be buffered. This means that everything that is displayed in the file stream cannot immediately be recorded on the disk (into a specific file). This is done, first of all, for considerations of performance. When the buffer data is written to the disk, it is called cleaning buffer. One way to clean the buffer is to close the file. In this case, all the contents of the buffer will be moved to the disk, and then the file will be closed.

Conclusion buffering is usually not a problem, but, under certain circumstances, it can cause careless newcomers. For example, when the data stored in the buffer and the program is prematurely completes its execution (either as a result of a failure or by calling). In such cases, the destructors of the file input / output classes are not executed, the files are never closed, the buffers are not cleared and our data is lost forever. That is why a good idea is the explicit closure of all open files before calling EXIT ().

Also the buffer can be cleaned manually using ostream :: Flush () or sending std :: Flush. in the output stream. Any of these methods can be useful to ensure immediate recording of the contents of the buffer to the disk in the event of a program failure.

An interesting nuance: Since STD :: ENDL; It also clears the output stream, its excessive use (leading to unnecessary buffer cleansing) may affect the performance of the program (since the cleaning of the buffer in some cases can be a cost operation). For this reason, programmers who care about the performance of their code are often used \\ n instead of STD :: Endl to insert a new string symbol in the output stream in order to avoid unnecessary buffer cleaning.

File opening modes

What happens if we try to write data into an already existing file? Re-launching the program above (the very first) indicates that the source file is fully overwritten when the program is restarted. And what if we need to add data to the end of the file? It turns out that the file stream takes an optional second parameter that allows you to specify the programmer how to open the file. You can transmit this parameter next flags (which are in the IOS class):

app. - opens the file in add mode;

aTE - goes to the end of the file before reading / recording;

binary. - opens the file in binary mode (instead of a text mode);

iN. - opens the file in read mode (default for ifstream);

out. - opens the file in recording mode (default for offream);

trunc - Deletes the file if it already exists.

You can specify several flags by way.

Ifstream works by default in iOS :: IN mode;

ofstream works by default in iOS :: OUT mode;

Fstream works by default in iOS mode :: in or iOS :: OUT, which means that you can perform both reading the contents of the file and write data into the file.

Now let's write a program that will add two lines to the previously created sometext.txt file:

#Include. #Include. // To use EXIT () #Include Int Main () (using namespace std; // Transfer the IOS flag: app to report Fstream, that we are going to add your data to already existing file data, // We are not going to overwrite the file. We do not need to transmit the IOS flag :: Out , // Because ofstream works by default in iOS :: Out Ofstream Outf mode :: Out Ofstream Outf ("Sometext.txt", iOS :: App); // If we cannot open a file to write data if (! OUTF) (// then output The following error message and perform EXIT () CERR<< "Uh oh, SomeText.txt could not be opened for writing!" << endl; exit(1); } outf << "See line #3!" << endl; outf << "See line #4!" << endl; return 0; // Когда outf выйдет из области видимости, то деструктор класса ofstream автоматически закроет наш файл }

#Include.

#Include. // To use EXIT ()

#Include.

iNT MAIN ()

using Namespace STD;

// Transfer the IOS flag: App to let FSTREAM report that we are going to add your data to already existing file data,

// We are not going to overwrite the file. We do not need to transmit the IOS :: OUT flag,

// Because ofstream works by default in iOS :: OUT mode

ofstream Outf ("Sometext.txt", iOS :: APP);

// If we cannot open the data file

iff (! OUTF)

// then display the following error message and perform EXIT ()

cerr.<< "UH OH, Sometext.txt Could Not Be Opened for Writing!"<< endl ;

eXIT (1);

Files allow the user to read large amounts of data directly from the disk without entering them from the keyboard. There are two main types of files: text and binary.

Text Called files consisting of any characters. They are organized by lines, each of which ends with the symbol " end line ". The end of the file itself is indicated by the symbol " eNTER FILE ». When writing information in a text file, you can view which you can use any text editor, all data is converted to the character type and stored in symbolic form.

IN binary Files information is read and recorded in the form of blocks of a certain size in which data can be stored for any type and structure.

Special data types are used to work with files, called threads.Flow ifstreamserves to work with files in read mode, and ofstream In recording mode. To work with files in both recording, and reading is the stream. fstream.

In C ++ programs when working with text files, you must connect libraries. iostream and fstream.

In order to record the data in the text file, it is necessary:

  1. describe a variable type ofstream.
  2. open..
  3. display information to the file.
  4. be sure to close the file.

To read data from a text file, you must:

  1. describe a variable type ifstream.
  2. open file using function open..
  3. read information from the file, when reading each data portion, it is necessary to check whether the end of the file will be achieved.
  4. close file.

Record information in a text file

As mentioned earlier in order to start working with a text file, you must describe the type variable ofstream. For example, so:

ofstream f;

A variable will be created F. To record information to the file. At the next stage, the file must be opened for recording. In general, the flow opening operator will look at:

F..open.("File", mode.);

Here F. - variable described as ofstream, file - the full file name on the disk, mode. - Mode of operation with the file being opened. Note that when specifying the full file name you need to install a double layer. For circulation, such as a file accounts.txt, located in the folder sites. on disk D.The program must specify: D: \\\\ Sites \\\\ accounts..txt.

The file can be opened in one of the following modes:

  • iOS :: In. - open the file in data reading mode; The mode is the default mode for streams. ifstream;
  • iOS :: Out. - open the file in data recording mode (information about the existing file is destroyed); The mode is the default mode for streams. ofstream;
  • iOS :: App. - open the file in data recording mode to the end of the file;
  • iOS :: ATE - move to the end of the already open file;
  • iOS :: Trunc. - Clear file, the same happens in iOS :: OUT mode;
  • iOS :: nocreate. - Do not perform the operation of opening a file if it does not exist;
  • iOS :: Noreplace - Do not open an existing file.

The Mode parameter may be absent, in this case the file opens in the default mode for this thread.

After a successful opening of the file (in any mode) in a variable F. will be stored true., otherwise false. This will allow you to check the correctness of the operation of the file opening.

Open the file (as an example take the file D: \\\\ Sites \\\\ accounts..txt) In recording mode, you can one of the following methods:

After opening a file in recording mode, an empty file will be created in which you can record information.

If you want to open an existing file in duplication, then you should use the value as a mode. iOS :: App..

After opening a file in recording mode, you can write in the same way as on the screen, only instead of a standard output device cout. You must specify the name of the open file.

For example, to write to the stream F.variable a.The output operator will look at:

F.<

For sequential output to stream G. variables b., c., d. The output operator will be:

G.<

Flow closing is carried out using the operator:

F.Close ();

As an example, consider the following task.

Task 1.

Create a text file D: \\\\ sites.\\accounts. .txt and write to it n. real numbers.

Decision

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include "stdafx.h"
#Include.
#Include.
#Include.
using Namespace STD;
iNT MAIN ()
{

int i, n;
double A;
// describes the stream to write data into the file
ofstream f;
// Open the file in recording mode,
// iOS :: OUT mode is set by default
F.Open ("D: \\\\ Sites \\\\ Accounts.txt », iOS :: OUT);
// Enter the number of real numbers
cout.<< «n=» ; cin >\u003e n;
// Cycle to enter real numbers
// and write them to the file
for (i \u003d 0; i< n; i++ )
{
cout.<< «a=» ;
// Entry of Number
cIN \u003e\u003e;
F.<< a<< «\\ t ";
}
// Flood closure
F.Close ();
sYSTEM ("PAUSE");
return 0;
}

Reading information from a text file

In order to read information from a text file, you must describe the type variable ifstream. After that you need to open a read file using the operator open.. If the variable is called F., the first two operators will be such:

After opening a file in reading mode, you can read the information just as from the keyboard, only instead cin. You need to specify the name of the flow from which data will take place.

For example, to read data from the stream F. in a variable A.The input operator will look like this:

F \u003e\u003e A;

Two numbers in a text editor are considered divided if there are at least one of the characters between them: a space, tab, the end symbol. Well, when a programmer knows in advance how many and what values \u200b\u200bare stored in a text file. However, only the type of values \u200b\u200bstored in the file are often known, while their number may be different. To solve this problem, it is necessary to read the values \u200b\u200bfrom the file alternately, and before each reading, check whether the end of the file will be achieved. And help make this function F.EOF (). Here F.- Flow Name The function returns a logical value: true. or falseDepending on whether the end of the file will achieve.

Consequently, the cycle to read the contents of the entire file can be written as follows:

For better assimilation of the material, consider the task.

Task 2.

In the text file D: \\\\ Game \\\\ Accounts.txt stored real numbers, display them on the screen and calculate their number.

Decision

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

#include "stdafx.h"
#Include.
#Include.
#Include.
#Include.
using Namespace STD;
iNT MAIN ()
{
SETLOCALE (LC_ALL, "RUS");
int n \u003d 0;
float A;
FSTREAM F;
// Open the file in read mode
F.Open ("D: \\\\ Sites \\\\ Accounts.txt ») ;
// If the file opening passed correctly, then
iF (F)
{
// cycle to read values \u200b\u200bfrom the file; The execution of the cycle will be interrupted,
// When reaching the end of the file, in this case f.eof () will return the truth.
while (! f.eof ())
{
// Read the next value from the flow F to the variable A
F \u003e\u003e A;
// Conclusion Variable value A on screen
cout.<< a<< «\\ t ";
// Increasing the number of numbers
n ++;
}
// Flood closure
F.Close ();
// Occasion on the number of numbers read
cout.<< «n=» << n<< endl;
}
// If the file opening passed incorrectly, the output
// Messages about the absence of such a file
eLSE COUT.<< " The file does not exist"<< endl;
sYSTEM ("PAUSE");
return 0;
}

On this relatively volumetric lesson on text files is completed. The following article will consider the methods of manipulation, with which in C ++ are processed.

Last updated: 10/31/2015

To work with directories in the System.io namespace, two classes are intended immediately: Directory and DirectoryInfo.

DIRECTORY class

The Directory class provides a number of static methods for directory management. Some of these methods:

    CreateDirectory: Creates a directory on the specified path PATH

    Delete (Path): Deletes the directory on the specified path Path

    Exists (PATH): Determines whether there is a directory on the specified path path. If there is, it is returned true if there is no, then false

    GetDirectories (PATH): Gets a list of directories in the Path catalog

    GetFiles (PATH): Gets a list of files in the Path catalog

    Move (SourcedirName, DestdirName): Moves catalog

    GetParent (Path): Getting a Parent Catalog

Class DirectoryInfo.

This class provides functionality to create, delete, move and other directory operations. In many ways it looks like Directory. Some of its properties and methods:

    Create (): Creates a catalog

    CreateSubdirectory (Path): Creates a subdirector for the specified path Path

    Delete (): Deletes catalog

    Exists property: Determines whether there is a catalog

    GetDirectories (): Gets a list of directories

    Getfiles (): Gets a list of files

    MoveTo (DestdirName): Moves the catalog

    Parent property: getting a parent catalog

    Root property: getting a root catalog

Let's look at the examples of the application of these classes

Getting a list of files and subdirectories

STRING DIRNAME \u003d "C: \\\\"; if (directory.Exists (DirName)) (Console.WriteLine ("Subdatalogues:"); String Dirs \u003d Directory.GetDirectories (Dirname); Foreach (String S in Dirs) (Console.WriteLine (S);) Console.Writeline ( ); Console.WriteLine ("Files:"); String Files \u003d Directory.GetFiles (dirname); foreach (string s in files) (Console.WriteLine (S);))

Pay attention to the use of lockers in file names. Either we use a double lay: "C: \\\\", either single, but then before all by putting the sign @: @ "C: \\ Program Files"

Creating catalog

STRING PATH \u003d @ "C: \\ SOMEDIR"; String subpath \u003d @ "Program \\ Avalon"; DirectoryInfo Dirinfo \u003d New DirectoryInfo (Path); if (! dirinfo.create ();) dirinfo.createsubdirectory (subpath);

First you check, and there is no such directory, since if it exists, it will be impossible to create it, and the application will throw a mistake. As a result, we will have the following way: "C: \\ Somedir \\ Program \\ Avalon"

Receiving information about the catalog

STRING DIRNAME \u003d "C: \\\\ Program Files"; DirectoryInfo Dirinfo \u003d New DirectoryInfo (Dirname); Console.WriteLine ($ "Catalog Name: (dirinfo.name)"); Console.WriteLine ($ "Full Catalog Name: (Dirinfo.FullName)"); Console.Writeline ($ "Catalog Creation Time: (dirinfo.creationtime)"); Console.WriteLine ($ "root directory: (dirinfo.root)");

Removing catalog

If we simply apply the Delete method to a non-empty folder, in which there are any files or subdirectories, the application will throw us an error. Therefore, we need to transfer the additional boolean type option to the Delete method, which will indicate that the folder must be deleted with all content:

STRING DIRNAME \u003d @ "C: \\ SOMEFOLDER"; Try (DirectoryInfo Dirinfo \u003d New DirectoryInfo (Dirname); dirinfo.delete (true); Console.WriteLine ("Catalog Remote");) Catch (Exception EX) (Console.WRITELINE (EX.Sessage);)

STRING DIRNAME \u003d @ "C: \\ SOMEFOLDER"; Directory.Delete (Dirname, True);

Moving catalog

String OldPath \u003d @ "C: \\ SomeFolder"; STRING NEWPATH \u003d @ "C: \\ SOMEDIR"; DirectoryInfo Dirinfo \u003d New DirectoryInfo (OldPath); if (dirinfo.exists && directory.exists (newpath) \u003d\u003d false) (dirinfo.moveto (newpath);)

When moving, it should be borne in mind that the new directory in which we want to make all the contents of the old directory should not exist.

For convenience of contacting, information in stored devices is stored as files.

The file is the named external memory area allocated to store the data array. The data contained in the files are of the most diverse character: programs on the algorithmic or machine language; source data for program operation or program execution results; arbitrary texts; graphic images, etc.

Catalog (folder, directory) - a named set of bytes on the media of information containing the name of the subdirectories and files is used in the file system to simplify the organization of the files.

File system The functional part of the operating system, which ensures the execution of operations on files. Examples of file systems are FAT (FAT - File Allocation Table, file placement table), NTFS, UDF (used on CDs).

There are three main versions of Fat: Fat12, Fat16 and Fat32. They differ in the discharge of records in the disk structure, i.e. The number of bits reserved for storing the cluster number. FAT12 is used mainly for floppy disks (up to 4 KB), FAT16 - for small volume disks, FAT32 - for high-capacity Flash-storage devices (up to 32 GB).

Consider the structure of the file system on the example of FAT32.

FAT32 file structure

The external memory devices in the FAT32 system have not byte, but block addressing. Recording information into the external memory device is carried out by blocks or sectors.

Sector is the minimum addressable information storage unit on external storage devices. As a rule, the sector size is fixed and is 512 bytes. To increase the address space of the external memory devices, the sector is combined into groups called clusters.

Cluster - Combining several sectors, which can be considered as an independent unit with certain properties. The main property of the cluster is its size measured in the number of sectors or bytes.

FAT32 file system has the following structure.

The numbering of clusters used to record files is carried out with 2. As a rule, Cluster No. 2 is used by the root directory, and starting from the cluster No. 3 is stored an array of data. The sectors used to store the information presented above the root directory, are not combined into clusters.
The minimum file size occupied on the disk corresponds to the 1st cluster.

The boot sector begins with the following information:

  • EB 58 90 - unconditional transition and signature;
  • 4D 53 44 4F 53 35 2E 30 MSDOS5.0;
  • 00 02 - the number of bytes in the sector (usually 512);
  • 1 byte - the number of sectors in the cluster;
  • 2 bytes - the number of backup sectors.

In addition, the boot sector contains the following important information:

  • 0x10 (1 byte) - the number of tables FAT (usually 2);
  • 0x20 (4 bytes) - the number of sectors on the disk;
  • 0x2c (4 bytes) - root directory cluster number;
  • 0x47 (11 bytes) - Tom label;
  • 0x1fe (2 bytes) - Signature of the boot sector (55 AA).

The file system information sector contains:

  • 0x00 (4 bytes) - signature system (52 \u200b\u200b52 61 41);
  • 0x1e4 (4 bytes) - signature (72 72 41 61);
  • 0x1e8 (4 bytes) - the number of free clusters, -1 if not known;
  • 0x1EC (4 bytes) - the number of the last recorded cluster;
  • 0x1fe (2 bytes) - signature (55 AA).

The FAT table contains information about the status of each cluster on the disk. The younger 2 bytes of the FAT table are stored F8 FF FF 0F FF FF FF FF (which corresponds to the condition of clusters 0 and 1, physically absent). Next, the status of each cluster contains a cluster number in which the current file or the following information continues:

  • 00 00 00 00 - cluster is free;
  • FF FF FF 0F is the end of the current file.
  • 8 bytes - file name;
  • 3 bytes - file extension;

The root directory contains a set of 32-bit records of information about each file containing the following information:

In the case of working with long file names (including Russian names), the file name encoding is performed in the UTF-16 encoding system. At this, the encoding of each symbol is given to 2 bytes. In this case, the name of the file is written in the form of the following structure:

  • 1 byte sequences;
  • 10 bytes contain the younger 5 file name characters;
  • 1 byte attribute;
  • 1 byte reserve;
  • 1 byte - checksum name DOS;
  • 12 bytes contain the younger 3 file name symbol;
  • 2 bytes - number of the first cluster;
  • the remaining symbols of a long name.

Working with files in SI

For a programmer, an open file is represented as a sequence of readable or recorded data. When opening a file with it binds i / O stream. Displayed information is written to the stream, the information entered is read from the stream.

When the thread opens for I / O, it binds to the standard File type structure, which is defined in stdio.h. The File structure contains the necessary file information.

The opening of the file is carried out using the Fopen () function, which returns the pointer to the File type structure, which can be used for subsequent file operations.

File * Fopen (Name, Type);


name - the name of the open file (including the path),
type is a pointer to the string of characters that define a way to access the file:
  • "R" - open a read file (file must exist);
  • "w" - open an empty file for recording; If the file exists, its content is lost;
  • "A" - open the file to write to the end (for adding); The file is created if it does not exist;
  • "R +" - open the file for reading and writing (the file must exist);
  • "W +" - open an empty file for reading and writing; If the file exists, its content is lost;
  • "A +" - open a file for reading and adding if the file does not exist, then it is created.

Return value - pointer to open stream. If an error is detected, NULL is returned.

The FCLOSE () function closes the stream or streams associated with open using the FOPEN () files feature. The closed stream is determined by the argument of the FCLOSE () function.

Return Value: Value 0 if the stream is successfully closed; EOF constant if an error occurred.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

#Include.
iNT MAIN () (
File * FP;
char Name \u003d "My.txt";
if ((FP \u003d Fopen (Name, "R")) \u003d\u003d NULL)
{
PrintF ( "Failed to open the file");
getchar ();
return 0;
}
// Open File managed
... // Required actions on data
FClose (FP);
getchar ();
return 0;
}

Reading symbol from file:

char Fgetc (stream);


The function argument is a pointer to the File stream. The function returns the code of a read symbol. If the end of the file is reached or an error occurs, the EOF constant is returned.

Write symbol in file:

fPUTC (symbol, stream);

The function arguments are the symbol and pointer to the File stream. The function returns the code of a read symbol.

FSCANF () and FPRINTF () functions are similar to SCANF () and PRINTF () functions, but work with data files, and have the first argument - pointer to the file.

fSCANF (stream, "formatvber", arguments);



Did you like the article? Share it