前段时间用Python写了个终端版本的谷歌翻译爬虫:
Continue reading...C 语言
Vim获取特定行作为字符串复制给变量
let headTxt=getline(1) 获取第一行赋值给字符串headTxt
1 2 3 4 5 6 7 8 9 10 11 |
if &filetype == "c" let headTxt=getline(1) if headTxt == "#include <gtk/gtk.h>" exec "!gcc `pkg-config --cflags --libs gtk+-3.0` % -o %<" exec "!./%<" else exec "!gcc % -o %< -lm -lreadline" exec "!./%<" endif |
...
Continue reading...C语言怎样用方向键(光标)移动修改输入的字符进行交互操作
需要使用到readline库,还有很多功能自行挖掘。
原来用C语言时一直想用交互操作的功能而不得,也没查找到相关方法,网上说的都不是想要的,仅仅是读取输入的是哪个方向键,根本不能交互操作。
Continue reading...C语言使用GTK3实现屏幕截图
1.将以下代码保存到screenshot.c中
#include
GdkPixbuf *get_screenshot()
{
GdkPixbuf *screenshot;
GTK3 gdk_pixbuf_get_from_window 运行错误segmentation fault (core dumped)
1 2 3 4 |
GError *error=NULL; gdk_pixbuf_save(pixbuf, "test.jpeg", "jpeg", &error); |
函数调用如上,问题出现在没有用可变参数,却同时也没有给可变参数赋值为NULL. 看官方文档发现了这句话: The...
Continue reading...什么是套接字地址socket address, sockaddr?
IP地址加上端口号即构成套接字地址,亦即是C语言中的sockaddr(socket address的简称)
Continue reading...