How to create a file in C and allocate space to it

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

    I feel like what you said is not clear! It shouldn't take me more to create a C++ file, right? It's easy to create with Notepad or VC++!

    Allocate space, those variables that you declare and then directly allocate memory space. If you want to dynamically allocate your memory, you can use the new operator to request the required memory. It's the same as malloc() in C!

  2. Anonymous users2024-02-04

    Mine too.

    I didn't care about it all the time.

    I deleted it just when it appeared.

    will not hinder normal work.

  3. Anonymous users2024-02-03

    It is possible to open up space dynamically, but it is generally not recommended because the problem is that it is difficult for beginners to manage memory. Often just use without release.

    Here's how.

    First, add the include header file, and then you can dynamically open it up when needed. For example, if I have a struct called node and I need n, I can first declare a struct pointer struct node *n; After that, n is dynamically opened up n=(struct node *)malloc (n*sizeof(struct node)); You can use n just like an array.

    For example, if I want to access the first struct, I can use n[0] to access it. Remember to release the memory free(n) after use;

  4. Anonymous users2024-02-02

    Your question is too broad to be analyzed in detail.

    Dynamically apply for space, usually implemented by using a pointer linked list.

    1. Check the data content in the file and define the structure variables;

    2. Define a struct head pointer; *head=null;

    3. Establish a file reading function, without reading a record, dynamically apply for a corresponding structure variable, and assign the read data to the applied variable, and add the variable to the pointer queue;

    4. Perform corresponding operations on the generated pointer queue.

    5. Finally, if you don't use it, release it.

    Common functions malloc, alloc, free, etc., there is another important point, every time you apply for a space, you must check whether the applied space is successful.

  5. Anonymous users2024-02-01

    1. Open the QQ space.

    2. To enter the album list, you can open an existing album, or create a new album3After entering the album, click Upload**.

    4. Select **, 5. Find the new folder in the pop-up window, and select**, or select all, and then upload, you can.

  6. Anonymous users2024-01-31

    Enter the space album, click the upload button, and then select your **location,Select ** and click OK to upload.

  7. Anonymous users2024-01-30

    Click Upload on the album in your space**. Then find your new folder. Got it?

  8. Anonymous users2024-01-29

    The fopen function in C++ does not have the function of creating folders, that is, what if? ".\\1\\2\\3\\"This directory does not exist, then the following ** is running with an error.

    char *filename=".\\1\\2\\3\\";

    file *ftest=fopen(filename,"w");

    fprintf(ftest,"testaldfaldkf\m");

    fclose(ftest);

    There are two ways to prevent this kind of mistake, one is to run away from it, and the other is to bite the bullet.

    1. Escape. char *filename=".\\1\\2\\3\\";

    file *ftest=fopen(filename,"w");

    if (!ftest)

    else

  9. Anonymous users2024-01-28

    Open, right-click Save As, and select Desktop!

  10. Anonymous users2024-01-27

    You can print the errorno out to try it out and see what the return value is, or it may be caused by the previous malloc crossing the bounds.

    Here's how to print errorno:

    printf("***d %d",errno,enomem);

    Yesterday, when I was modifying my own **, I encountered a malloc function memory allocation failure, and I flipped through the Internet, and a very likely reason was that there was a cross-border operation in the previous **, which led to the destruction of some of the information involved in the malloc allocation function. Under the guidance of this thought, today I was depressed all day, looking back and forth at my own **. After continuous debugging, I finally found that one of my ** malloc allocated memory size was 0, not the size I expected, and then ** operated on the memory according to the expected size, resulting in the next malloc could not allocate memory.

    Summarize your own problem, if you encounter such a problem next time, you have to check the malloc function that can not be allocated to start back to find the nearest malloc that can be allocated, the problem should be in this part, the most likely reason is that the pointer is out of bounds, the unknown memory is operated, resulting in malloc can not continue to allocate memory.

  11. Anonymous users2024-01-26

    The name of the empty folder will be written to the boot area, which is equivalent to a very small (negligible) hard drive, but the system will show that the folder occupies 0

    If there are a large number of empty folders, such as 10,0000, it will also affect the browsing speed, but it is also very small.

    The disadvantage of empty folders is mainly that it affects the user's management and browsing, but the space taken up is negligible!

  12. Anonymous users2024-01-25

    Of course, it takes up space, and it takes up space in the file allocation table. If there are enough empty directories, even if they are not large, they can cause the file allocation table to be full and not be able to write to the hard disk!

  13. Anonymous users2024-01-24

    This is the virus quarantine of the virus software, and the virus files that can't be killed are all in it, so you can delete them.

  14. Anonymous users2024-01-23

    Isolation. folders, anti-virus software.

    and so on, you can delete it! Some can't be killed.

    Virus. Can be isolated there.

Related questions
9 answers2024-02-09

3 ways. 1. After changing the name, click File Replacement, browse to the file location and click Replace, and then save. >>>More

17 answers2024-02-09

Step 1 Method: Start by double-clicking to open PhotoshopCS4 >>>More

12 answers2024-02-09

Click "Start" - "Run" in the bottom left corner of the desktop, and then type "DXDIAG" Enter, which will launch the DirectX diagnostic tool, and you can see the current version number to the right of the "DirectX Version" entry in the lower part of the "System" tab. >>>More

7 answers2024-02-09

The positioning of the ghoul is mainly the damage output First of all, let's introduce the skill The r of a skill increases the attack speed and magic immunity gives him a stable output environment Feast This is very powerful and does not explain the tearing wound and slowing down the attack and adding blood violently Haha The ultimate is not explained Now say the outfit Ghoul as a damage output can be out of the prosthetic leg or phase Then you can come out of the armband Final equipment: prosthetic leg or phase. Flying shoes (this is nothing, but don't be a secret method) Dragon heart (meat) Cannon (more fierce output) Darkness (reduce defense, haha is very good for Li) Attack (increase attack speed and reduce defense, good) Armband (add more than 400 lives when you open it, very good for Li.) >>>More

10 answers2024-02-09

Random numbers in pascal.

Random numbers refer to a series of numbers that theoretically have no rules to follow, have an equal probability of each number appearing within a specified range, and cannot be used to follow the previous number. The basic principle of a general random number generator is: first, initialize a random seed, the initial value of which can be an arbitrary integer; Every time a random number is obtained, a special operation is performed based on the random seed, a random number is obtained and returned, and then some operation is performed on the random seed to change the value of the random seed. >>>More