errno

实验五 通讯协议设计

荒凉一梦 提交于 2019-12-06 06:46:15
实验五 通讯协议设计-1 一、任务详情 在Ubuntu中完成 http://www.cnblogs.com/rocedu/p/5087623.html 中的作业 提交运行结果截图 1.访问OpenSSL的官网https://www.openssl.org/source/,下载最新版本的OpenSSL: 2.使用tar xzvf openssl-1.1.0j.tar.gz命令解压文件 3.使用cd openssl-1.1.0j命令进入目录 4.然后使用下列命令编译安装: ./configure make sudo make install 5.使用make test测试一下有没有问题: 编写一个测试代码test_openssl.c #include <stdio.h> #include <openssl/evp.h> int main(){ OpenSSL_add_all_algorithms(); return 0; } 3.接下来用下面命令编译: gcc -o to test_openssl test_openssl.c -I /usr/local/ssl/lib -lcrypto -ldl -lpthread 4.执行echo $?   结果显示为0,表明测试已经通过,如下图: 实验五 通讯协议设计-2 1.任务详情 在Ubuntu中实现对实验二中的“wc服务器

Mysql: ERROR 1005 (HY000): Can't create table 'receitascakephp.recipes' (errno: 150)

僤鯓⒐⒋嵵緔 提交于 2019-12-06 06:00:49
CREATE TABLE `users` ( `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `username` VARCHAR(75) NOT NULL, `password` VARCHAR(75) NOT NULL, `image` VARCHAR(255) ); CREATE TABLE `recipes` ( `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `method` TEXT NOT NULL, `image` VARCHAR(255), `user_id` INT NOT NULL, CONSTRAINT `fk_recipes_users` FOREIGN KEY(`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; I don't know why, but I'm getting: ERROR 1005 (HY000): Can't create table 'receitascakephp.recipes' (errno

UNIX编程 I/O多路转接笔记

无人久伴 提交于 2019-12-06 02:37:52
在标准输入上测试select 实现参考了《UNIX环境高级编程》14.4.1和《UNIX系统编程手册》63.2.1。 #include <cstdio> #include <iostream> #include <unistd.h> #include <fcntl.h> #include <sys/select.h> using namespace std; const int BUF_SIZE = 128; int main(int argc, char **argv) { fd_set rs; FD_ZERO(&rs); FD_SET(STDIN_FILENO, &rs); for (int i = 0; i < 5; i++) { timeval tv = {.tv_sec=2, .tv_usec=0}; fd_set rs_temp = rs; int ret = select(STDIN_FILENO + 1, &rs_temp, NULL, NULL, &tv); if (ret == -1) { printf("select ret: %d, errno: %d\n", ret, errno); return 1; } printf("select ret: %d\n", ret); printf("if can read data from fd: %d is %s

Error Compiling CSS Asset

ぐ巨炮叔叔 提交于 2019-12-06 00:13:21
问题 I have been trying to deploy a Rail 3.1.1 app on CentOS 6 This is the error I am getting Error Compiling CSS Errno::ENOENT: No Such File or Directory - /var/www/vhosts/MySite/MyAPP/tmp/cache/assets/sprockets%t43t34t34t...t34t-r32r-r23.lock /usr/local/lib/ruby/1.9.1/tempfile.rb:343:in 'rmdir' I appreciate the help. 回答1: There were actually 2 problems. First the permissions were wrong. and secondly like Nerian said, you have to clear your tmp folder. To set the correct permissions chown apache

Default value of errno variable [closed]

被刻印的时光 ゝ 提交于 2019-12-05 23:22:00
I want to use the errno library in order to define the return of a project (c language) functions. And I'm wondering about something... I will do something like this : #include <errno.h> int myfunction (void) { int res; /*Some actions....*/ if(success) res = 0; else if (fail) res = -EIO; return res; } I like to always initialize my local variable and I am wondering what should be the default value of a variable using the errno value (probably 0) ? But I don't really like to set by default : "SUCCESS" I prefer a "Failure" value. What is your point of view (or rule) about it ? Thanks by advance.

文件打包学习3

放肆的年华 提交于 2019-12-05 14:53:40
之前存在的弱点 文件虽然打包成一个文件,但是对于打包后的文件内容依然是明文的,不安全 常用加密算法 AES 密码学中的高级加密标准(Advanced Encryption Standard,AES),又称高级加密标准Rijndael加密法,是美国联邦政府采用 的一种区块加密标准。这个标准用来替代原先的DES,已经被多方分析且广为全世界所使用。 XOR加密 同一值去异或两次就可以恢复出原来的值,因此它是最简单的可逆的操作,也是最简单的加密算法 自定义算法 NewPackage.h #ifndef NEWPACKAGE_H_ #define NEWPACKAGE_H_ #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <vector> #include <string> class CFileBuffer { public: CFileBuffer():m_pBuffer(nullptr),m_nSize(0) { } ~CFileBuffer() { Destroy(); } //创建一块内存 bool Create(size_t Size) { Destroy(); m_pBuffer = malloc(Size); if(!m_pBuffer) {

Linux, convert errno to name

岁酱吖の 提交于 2019-12-05 10:42:17
I am looking for an API to convert an errno integer to its name. For example: int fd; if((fd = open(path, O_RDONLY)) == -1) printf("error: %d %s %s\n", errno, strerror(errno), ERRNONAME(errno)); So, ERRNONAME would yield a name, such as "EINVAL" , "EPERM" , etc. Is this possible? I recently wrote the errnoname library that has an errnoname function which does exactly this. There is unfortunately still no standard API to do this in C, and near as I can tell no other open source C library doing this. There is nothing hard or complex about it, it is just really tedious to implement by hand, to

Socket bind failed errno = 99

荒凉一梦 提交于 2019-12-05 10:31:39
I'm trying to bind the server socket so I can receive and listen for incoming messages from other clients. But I can't bind, it returns an error - Socket bind failed: 99. I read up what does it mean and it says that errno 99 indicates that the socket does not exist? Any ideas? Thanks UDP_socketID = socket(AF_INET, SOCK_DGRAM, 0); if (UDP_socketID < 0) { printf("Socket creation failed! Error = %d\n\n", errno); exit(0); } //specify server address, port and IP bzero((char *)&serverAddr, sizeof(serverAddr)); serverAddr.sin_family = AF_INET; serverAddr.sin_addr.s_addr = htonl(INADDR_ANY);

In Windows, is there any way to convert an errno into an HRESULT?

浪子不回头ぞ 提交于 2019-12-05 07:14:29
I know the HRESULT_FROM_WIN32 macro to convert a Win32 error code into an HRESULT, is there any way to do the conversion starting from an errno error? In short, no. As of http://msdn.microsoft.com/en-us/library/5814770t%28v=vs.100%29.aspx The errno values are constants assigned to errno in the event of various error conditions. ERRNO.H contains the definitions of the errno values. However, not all the definitions given in ERRNO.H are used in 32-bit Windows operating systems. Some of the values in ERRNO.H are present to maintain compatibility with the UNIX family of operating systems. The errno

error: [Errno 13] Permission denied: '/usr/local/lib/处理方法

倖福魔咒の 提交于 2019-12-05 06:54:19
在ubuntu系统下使用pip 命令安装包时,出现以下类似错误提示: error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/ 那么,要用root权限,可以用sudo表示用root权限执行,在命令前面加sudo命令 来源: https://www.cnblogs.com/smallleiit/p/11911851.html