File extensions for program codes: cpp - what is it?

This article is about extension and its importance for computer systems. Here, it would seem that such a special thing can be in the extension of the program file? Nevertheless, we hope that readers will be able to get important and interesting information for themselves. The ability to deal with extensions will do a good job, which will be described below.

What extension does C plus plus have?

cpp this
This programming language has its own file designation. The cpp designation is a special extension used for files with C ++ code. They contain code that is not yet ready for use (not compiled), which you can edit and make corrections without significant costs and crashes in the program. Using this extension, you can find out which file contains text in "C" (a programming language that is now very popular).

Extension and its importance in programming

c plus plus
Why do you need a file name extension that is used by a computer? The fact is that a computer can process many different types of files, both within the framework of the installed operating system, and with the help of additional software. An example of such software can be plug-ins installed in browsers, or interpreters of various programming languages ​​that can process running programs. Here's to recognize which interpreter should use the computer, what kind of machine code to use to play the file, and extensions are needed. The machine code recognizes the type of file, this information will be provided to him by the existing details. So, the cpp extension is a file containing a C ++ document. After recognition, the interpreter will be able to open it, and the user will be able to work with the document.

What is a file name extension in general?

file name extension

But let's talk about file name extensions in terms of computer science. We have already decided on its purpose - it is needed to identify the format or type of file. Detach extension from file name with dot. Until the 95th, β€œWindows” had a limit on the number of characters in the extension: they could not be more than three. In modern systems, there is no such limitation. Even more, in modern file systems there may be files that have several types of extensions. They all follow the dot. True, this does not apply to such as cpp.

Such a gift from developers is often used by scammers. Attackers often disguise their malicious files, which they shove onto users' computers, as other programs, hide the main file extension (it differs from ordinary programs in viruses and various trojans). It may even be that all real files are hidden or deleted, and completely different ones are slipped in their place. And it turns out that cpp is not cpp at all, but a computer virus. A good defense against this type of scam is the team showing all types of extensions. You can enable this function in the "Control Panel", just find the file properties and the necessary item. And then you can be calm about your C plus plus files, and confident that you will not run a harmful program instead. Although here you should always look at the extension of executable files.

The accuracy of the information provided in the extension

si programming language

Sometimes the extension does not accurately indicate the type of file and does not solve all the possible problems that may arise during the use of various programs. So, the .txt extension, familiar to many, does not provide information to the computer about the encoding of the file. Therefore, often when opening text files you can see sheets of strange characters. It is especially sad to see such a state of a document if it was used to write program code. In such cases, file encodings should be changed until the computer can provide adequate text. You can try to calculate the necessary encoding based on incorrect characters, but you need to know which encoding with respect to which it leads to. For Word files, the same extension is also used, which does not make it clear which file a person is dealing with: a regular type or a formatted one. Also, the extension does not indicate which version is used, which manifests itself well when trying to open versions of earlier documents in later processing environments, as is the case with Microsoft Office.

Other ways and options to specify the format

There are other options to specify the file format for the file system. But they are not common, and you most likely have never heard of them:

  • Saving information about the file format in the operating system itself. Inconvenience occurs when you want to switch to another computer and work with the same file.
  • The use of the so-called method of "magic numbers." This is when a certain sequence of bytes is encrypted in the file itself, which indicates all the necessary information for the file to work. It has a certain potential, but the cooperation of software manufacturers is needed.
  • A function has been developed for some Unix systems that leaves special notation at the beginning of the file for the interpreter.

Source: https://habr.com/ru/post/K4125/


All Articles