C file operation 1: how to write and read? How to use the six combination parameters of fopen?

File operation in C language, that is, file opening, file writing, file reading, file closing, etc. When using these functions, you need to understand their basic usage rules, such as: Before reading or writing a file, you must first use the fopen function to open the file. When using fopen to open, you should also specify the parameters for ...

Added by thinkgfx on Sat, 19 Feb 2022 18:18:33 +0200

Week 5 of 2005 -- program design and algorithm test

28: the number of the same number as the specified number Total time limit: 1000ms memory limit: 65536kB describe Outputs the number of the same number as the specified number in an integer sequence. input The input contains three lines: The first line N represents the length of the integer sequence (N < = 100); The second line is N integ ...

Added by kjelle392 on Sat, 19 Feb 2022 12:52:39 +0200

Binary tree [C language]

1. Trees Nonlinear data structure Trees are recursively defined Each tree is composed of root + multiple subtrees, and the subtree structure is the same Representation of trees The tree has no rules on how many children he has C + + will be easier to write Left child right brother notation struct Node { struct Node* _ ...

Added by cjconnor24 on Sat, 19 Feb 2022 10:50:28 +0200

c language sorting algorithm

C language sorting algorithm 1. Bubble sorting Bubble Sort is A simple sort algorithm. It repeatedly visits the sequence to be sorted, compares two elements at A time, and exchanges them if their order (e.g. from large to small and from A to Z) is wrong. #include <stdio.h> void bubble_sort(int arr[], int len) { int i, j, temp; ...

Added by LonelyPixel on Sat, 19 Feb 2022 06:40:46 +0200

[data structure from bronze to king] Part 4: queue of data structure

Catalogue of series articles preface 1, Concept and structure of queue 1. Concept of queue Queue: a special linear table that only allows inserting data at one end and deleting data at the other end. The queue has a first in first out FIFO(First In First Out) into the queue: the end of the queue where the inserting operation i ...

Added by PoOP on Sat, 19 Feb 2022 00:57:44 +0200

The callback function used to be so easy to understand

  1 what is a callback function? First, what is "callback"? My understanding is: pass an executable code to other code like parameter passing, and this code will be called and executed at some time, which is called callback. If the code is executed immediately, it is called synchronous callback. If it is executed later, it is ...

Added by Genux on Fri, 18 Feb 2022 22:24:55 +0200

OS Experiment 4 of Harbin Institute of technology -- tracking and statistics of process running track

Tracking and statistics of process running track The whole process from the creation of a process (call fork() under Linux) to the end is the life cycle of the process. The running track of the process in its life cycle is actually represented by multiple switching of the process state. For example, after the process is created, it will become ...

Added by gsaldutti on Fri, 18 Feb 2022 12:40:46 +0200

Explain Linux threads in detail

concept A process is the smallest resource allocation unit of the operating system, while a thread is the smallest scheduling unit of the operating system. In other words, a program will create a process when it is running. The process has at least one thread, and the operating system schedules this thread to operate when scheduling. There ...

Added by Norsk.Firefox on Fri, 18 Feb 2022 08:07:38 +0200

C language notes Day01

data type Char character data type char ch = 'a'; Short integer short num = 10; Integer int Long long integer long long longer integer Float single precision floating point number float weight = 55.5; Double double d = 0.0; Print an integer printf ('% d', 1000;) sizeof - Keyword - Operator - space occupied by calculation type or variable - u ...

Added by webtuto on Thu, 17 Feb 2022 23:01:28 +0200

Embedded C language development file IO programming open/close/read/write/stat/fstat/lstat

open/close int fd2; fd2=open(argv[1],O_RDWR | O_CREAT | O_EXCL,0655); if(fd2==-1) { perror("open file error!"); exit(1); } printf("fd2=%d\n",fd2); int ret=close(fd2); printf("fd2=%d\n",fd2); printf("ret=%d\n",ret); Partial code O_RDONLY O_WRONLY O_RDWR: read only write only O_CREAT: create when the f ...

Added by jtrost on Thu, 17 Feb 2022 09:29:27 +0200