当前位置:网站首页>Raspberry pie preliminary use
Raspberry pie preliminary use
2022-06-22 04:00:00 【Protect the milk cat】
List of articles
One 、 Create a new user
Create user :
sudo useradd -m user name
Set the password :
sudo passwd user name
Give users sudo jurisdiction ( The following file transfer needs ):
# Switch to root user
sudo su
# Edit profile
vi /etc/sudoers
# Increase the configuration ( Press i Start editing ,Esc Exit the editor ,:wq! Save forced exit ), In the open configuration file , find root ALL=(ALL) ALL, Add a line below
# among xxx Is the name of the user you want to join
xxx ALL=(ALL) ALL

Two 、C Program practice
1. Create a c Program
vi The program name .c
2. Get into vi Edit mode , Press i Start writing code
#include <assert.h>
#include <stdio.h>
int main()
{
int a;
char str[50];
printf(" Please enter an integer value : ");
scanf("%d", &a);
assert(a >= 10);
printf(" The integer entered is : %d\n", a);
printf(" Please enter the string : ");
scanf("%s", str);
assert(str != NULL);
printf(" The input string is : %s\n", str);
return(0);
}
3. Press Esc Exit edit mode , Input :wq( Means save and exit )
4. compiler
First program name .c It's the code just written , The second program name is where the code results are output
gcc The program name .c -o The program name
5. Run the program
A program name of the second in the previous step
./ The program name
3、 ... and 、assert() understand
brief introduction
C Standard library assert.h The header file provides a file named assert The macro , It can be used to verify the assumptions made by the program , And output the diagnostic message when it is assumed to be false .
Library macro
assert.h The header file defines a unique function :assert()
void assert(int expression) This is actually a macro , Not a function , Can be used in C Add diagnostics to the program .
C Library macro - assert()
describe :C Library macro void assert(int expression) Allows diagnostic information to be written to the standard error file . let me put it another way , It can be used in C Add diagnostics to the program .
Statement :void assert(int expression);
expression : This can be a variable or anything C expression . If expression by TRUE,assert() Do nothing . If expression by FALSE,assert() Will be in standard error stderr An error message appears on the , And stop the program execution .
Return value : nothing
example :
Take the above code as an example
#include <assert.h>
#include <stdio.h>
int main()
{
int a;
char str[50];
printf(" Please enter an integer value : ");
scanf("%d", &a);
assert(a >= 10);
printf(" The integer entered is : %d\n", a);
printf(" Please enter the string : ");
scanf("%s", str);
assert(str != NULL);
printf(" The input string is : %s\n", str);
return(0);
}
If the entered integer is greater than or equal to 10, The input string is not empty , The program will continue to run ; If the conditions are not met, the program terminates

Four 、 Different Linux File transfer between systems
If in Ubuntu File transfer between system and raspberry pie system
scp Command Introduction
Linux scp The command is used for Linux Copy files and directories between .
scp yes secure copy Abbreviation , scp yes linux Based on ssh Log in for secure remote file copy command .
scp It's encrypted. ,rcp It's not encrypted ,scp yes rcp The enhanced .
grammar
scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[[email protected]]host1:]file1 [...] [[[email protected]]host2:]file2
example
Copy from local to remote :
scp local_file [email protected]_ip:remote_folder
perhaps
scp local_file [email protected]_ip:remote_file
perhaps
scp local_file remote_ip:remote_folder
perhaps
scp local_file remote_ip:remote_file
The first 1,2 User name specified , After the command is executed, you need to enter the password , The first 1 Only remote directories are specified , The file name does not change , The first 2 Specified file name ;
The first 3,4 No user name specified , After the command is executed, you need to enter the user name and password , The first 3 Only remote directories are specified , The file name does not change , The first 4 Specified file name ;
application ( Will raspberry pie just created .c File transfer to Ubuntu Next ):
sudo scp assert.c [email protected]:/home/xjc/
Connection timeout may occur ( Virtual machines can ping Raspberry pie , Raspberry pie can't ping Through virtual machines ), At this point, it is necessary to VMware The network connection mode of is modified to Bridging mode , After the change, if you use SSH client (Putty、Xshell class ) De link Ubuntu Of , To reconnect ,IP The address has changed 
And then execute scp command , You can successfully upload 

Four 、 reference
C Language assertion assert- From source code analysis to skilled use
Linux scp command
Virtual machines can ping Raspberry pie , Raspberry pie can't ping Through virtual machines
边栏推荐
- Adjacency matrix, adjacency table, cross linked list, adjacency multi table
- LOCAL=NO
- 如何快速定位bug和编写测试用例?
- Storage structure of tree
- 【牛客刷题-SQL大厂面试真题】NO1.某音短视频
- Fluent syntax configuration
- Redis和MySQL如何保持数据一致性?强一致性,弱一致性,最终一致性
- Invalid character found in request destination. Valid characters are defined in RFC 7230 and RFC 3986
- Resources for all projects
- Hierarchical traversal of binary tree
猜你喜欢

Basic concept of graph

TCL Huaxing released the world's first 0.016hz ultra-low frequency OLED wearable device screen

Wireshark数据包分析——wireshark0051.pcap

Shutter status management

低功耗雷达感应模组,智能锁雷达感应方案应用,智能雷达传感器技术

IIR filter design basis and MATLAB design example

Clue binary tree

【BP回归预测】基于matlab GA优化BP回归预测(含优化前的对比)【含Matlab源码 1901期】

Balanced binary tree -- adjusting transformation rules

顺序表的基本操作
随机推荐
How to realize SVN efficient management
read stream 特别注意
How to quickly locate bugs and write test cases?
Application method and operation of Beifu cx9020 (wince 7) controller
Beifu twincat3 ads error query list
PHP connection to mysql8.0 reports an error: illuminate\database\queryexception
二叉树线索化
积加ERP全局参数灵活配置成本取值规则,核算全面到位
Dart异步是怎麼實現
IIR filter design basis and MATLAB design example
我在华为度过的 “两辈子”(学习那些在大厂表现优秀的人)
H index problem
Adjacency matrix, adjacency table, cross linked list, adjacency multi table
How far is the memory computing integrated chip from popularization? Listen to what practitioners say | collision school x post friction intelligence
Basic operation of sequence table
La première femme vient à 3A? Est - ce que Bright name, approuvé par IGN, peut mettre en évidence le classement
Resources for all projects
线索二叉树
树莓派初步使用
Implementation of common function blocks for Beifu twincat3 servo control