Learning problems encountered in the process

(I found a very good site can find Linux commands: http: all the command //man.linuxde.net/,linux can find get, super useful)

1. "./" and "/" What is the difference?

A: "./" refers to the user's current directory; "/" refers to the root directory.

 

2. Environment Variables

 

3. The pipe
output (conduit can connect a series of commands, the first command as the second
command is inputted, the second command is passed to the conduit, and the output of the second command as
the third command input and so on.)

 

4."<" 、">"、">>"的区别

"<" Output

">" Covered writing (input)

">>" additional write (input)

 

5. & absolute path relative path

Depending on the wording of the file name, you can put the so-called path is defined as an absolute path and relative path

Absolute path: from the root directory (/) file or directory name began to write plays.

Relative path: the path relative to the current wording of the file name.

There are several special directories need special attention:

. "" Represent the current directory, you can also use "./" means

".." on behalf of parent directory, you can also use "../" means

"-" on behalf of a former working directory

"~" Represents the current master file folder where the user's identity

(I understand) root directory should be the bottom. It is calculated from the relative path to the current position, and the absolute path from the root directory (/) begin to run.

 

6. Special attention, vim is not a command, but the file editor.

 

7. What is argc? What is argv?

arg is an abbreviation parameters (arguments) of, argc and argv parameters refer.

argc refers to the number of parameters, it can be said that the given statistics when you run the program main function of the command-line parameter number.

argv points to running the full path name.

 

Task 1: Write a c program that can be similar to the cat command and configure the same environment variable.

Task 2: Write a program that can copy images with an executable program.

 

1.c / c ++ pointer file operations --FILE

Language file system file called flow (stream) of the main stream (text file) binary stream (binary file)

File system associated with the operation of all data structures defined in stdio.h

 

The general process for file operations:

Definition file pointer FILE *

Open the file fopen

To read and write files

 

FILE structure

 FILE *fr,*fp,*fw;

FILE * pointer as file handles, is a unique identifier file access, which is created by the function fopen, fopen to open the file successfully, a valid FILE * pointer is returned, otherwise null pointer NULL

 

Standard file pointer

FILE *stdin,*stdout,*stderr,

 stdin refers to the keyboard input

 display means stdout

 stderr pointed the wrong output device, also refers to the display

These variables are initialized successfully, can be used directly.

 

How it reads characters from the stream in c language? - with getc () function

Usage: Type the characters [read] getc (FILE * stream); 

Return Value: From the stream file stream file pointer points to read a character, and it functions as the return value to an integer variable ch, the file pointer to read characters and does not move, the location identifier move forward. If the read failure or end of the file returns EOF (-1)

 

How to open a file in the c language in it? - with fopen () function

用法:FILE *fopen(const char*path,const char*mode);

Return Value: after successfully opening the file, the file pointer will be returned stream. If the file open fails it returns NULL, and the presence of error in the error code.

Parameters: Parameters path string representing the file path and file name, mode string representing the flow of morphological parameters.

Common mode string form:

r: open the file in read-only mode, the file must exist.

w: Open the write-only file, if the file exists cleared to zero length file (the file disappears), if not exist, create the file.

In the c language how close open files? - with fclose () function

 

putchar in c language () and getchar ()

Guess you like

Origin www.cnblogs.com/181118ljh123/p/12002276.html