linux网络编程基础知识2

一、火狐浏览器若遇到访问超过普通端口80时,出现此地址访问受限的提示的话,可修改火狐浏览器的about:config,新建->字符串,输入network.security.ports.banned.override,取值范围设置为0~65535(简单方法,取全范围)

二、循环遍历目录
头文件添加
#include
#incldue
int scandir(const char* _dir,struct dirent ***namelist,int (*select),int (*cmp))

例子:

struct dirent **ptr;
int num=scandir(dir,&ptr,NULL,alphasort);
//遍历
if(int i=0;id_name;
	。。。。。。
}

注:If you use -std=c99, only functions that are strictly a part of the C99 standard are included by the header files. scandir() is not in the C99 standard. Therefore, you have to set a preprocessor variable to ensure that the function prototype is included. For example, the man page for scandir() indicates that setting the _BSD_SOURCE or _SVID_SOURCE preprocessor variables before you do the #include will fix the problem. Or, you can use #define _GNU_SOURCE which will in turn set quite a few different variables for you (including _BSD_SOURCE and _SVID_SOURCE)
Your code will still compile with the warning and work because C allows you to compile with implicitly defined functions, and the linker will correctly link the call to scandir() to the proper function.
即:若使用C99,则在头文件中需添加#define GNU_SOURCE
解决方法:gcc -D_GNU_SOURCE -std=c99

你可能感兴趣的:(c,Linux)