C Can I write objects to a file?

Updated on technology 2024-05-14
7 answers
  1. Anonymous users2024-02-10

    Yes, fwrite is the same as c, but it can only be a file, not a directory.

    C is a structured language. It is clearly hierarchical, easy to organize programs in a modular way, and easy to commission and maintain. The C language is extremely expressive and processive.

    It not only has a rich set of operators and data types, but also facilitates the implementation of all kinds of complex data structures. It also has direct access to the physical address of the memory for bit-level operations.

    Since C implements the programming of hardware, C combines the functions of a high-level language and a low-level language. It can be used for the development of both system software and application software. In addition, the C language is also highly efficient and portable.

    As a result, it has been widely ported to all types of computers, resulting in a variety of versions of the C language.

    Related information

    C language is one of the most popular programming languages today, it is rich in functions, strong expression, flexible and convenient to use, wide range of applications, high target program, good implantability, has the characteristics of high-level language, and has many characteristics of low-level language, suitable as a system description language, can be used to write system software, can also be used to write application software.

    After the advent of C, many of the software that was originally written in assembly language can now be written in C (such as the UNIX operating system), and it is much easier to learn and apply C than to learn and apply assembly language. c began to enter other operating systems, and soon became widely used in all kinds of large, medium, small and micro computers.

  2. Anonymous users2024-02-09

    Yes, fwrite(), the same as c, but it can only be a file, not a directory.

  3. Anonymous users2024-02-08

    Yes, there is a class called data serialization. It's very convenient.

  4. Anonymous users2024-02-07

    Yes, the object needs to be serialized.

  5. Anonymous users2024-02-06

    What is it? Do you write your own class objects? To figure out the data structure of the object, only some clear, computer-acceptable data can be written, for example, if you want to write an "expression" object to a file, it is too general, you should parameterize this object, such as 0 means expressionless, 1- means smile, 2- means pain, and so on, of course, there can be other more complex data types, through your program processing, you can write the data of the object to the file, as for the specific technology of writing, You can use the serialization (or serialization) of a VC, or you can directly call the operation function of the file stream, or a function such as fwrite().

    In short, the objects in the program business logic must be parameterized, or called data abstraction, in order to be processed by the computer, and the current computer is not really "intelligent" after all, but essentially just processing a bunch of "0 1"**.

  6. Anonymous users2024-02-05

    It is better not to have virtual functions, and you can write those that do not.

  7. Anonymous users2024-02-04

    There will be byte alignment problems, usually 4-byte alignment.

    For example: struct test

    test a;

    sizeof(a) results in (char)1 + aligned bytes)3 + int)4 = 8

    Here's a detailed explanation.

Related questions
14 answers2024-05-14

DataTable inherits from MarshalbyValueComponent.

MarshalbyValueComponent itself is an object, so it's a reference type, but this class is encapsulated by value when it is remoting, e.g. DataTable is derived from this class. >>>More

5 answers2024-05-14

Dynamically create controls:

for (int i = 0; i < 10; i++)string strname = "textb" + >>>More

6 answers2024-05-14

I don't know if you know anything about memory allocation. >>>More

3 answers2024-05-14

1) The const object calls the st member function.

2) Non-const member functions can call const member functions, which are generally used to avoid duplication, but introduce a casting action. >>>More

10 answers2024-05-14

I don't understand your intentions, so you probably want to use polymorphism. >>>More