摘要: char** argv == char* argv[]inint main(int argc, char* argv[])e,g: int (* pz)[2]; //a pointer(pz) points to an array of 2 ints.int * pax[2]; // 2 pointersdynamic multi-dimensional arrays in Cfunc(int x, int y, int a[x][y]) { ... }where the array dimensions are specified by other parameters to the fun 阅读全文
posted @ 2012-10-27 23:42 jeremyatchina 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 1. 使用在全域變數或全域函式 (Global variable &Global function)讓該變數(或該函式)的可視範圍只侷限在該檔案內,其他的 .c檔看不到此變數(或函式)的存在。既使其他檔案用extern宣告也看不到!套句行話來說,他把Global的變數或函數變成了「internal linkage」,當Linker在找symbol時是會忽略它的。(在C++中也相容這種用法,不過被視為比較不建議的舊的用法,C++比較建議使用unnamed namespace。)使用時機:當此全域變數(或全域函式)不想被其他檔案引用和修改時,或者不同檔案可以使用相同名字的全域變數(或全域函 阅读全文
posted @ 2012-10-27 12:32 jeremyatchina 阅读(2735) 评论(0) 推荐(0) 编辑
摘要: AbstractC語言並沒有提供一個函數專門將int, double轉字串,必須透過一個小技巧。Introduction有的compiler有提供itoa()與ltoa()將int, double轉字串,不過這些並非ANSI C標準,真正標準該使用sprintf()。double_to_string.c / C1/*2(C) OOMusou 2008http://oomusou.cnblogs.com34Filename : double_to_string.c5Compiler : Visual C++ 9.0 / Visual Studio 20086Description : Demo 阅读全文
posted @ 2012-10-27 12:01 jeremyatchina 阅读(271) 评论(0) 推荐(0) 编辑
摘要: Its no "string" data style in C language.If you really want string,then usetypedef char* string;So we have to use char array.Beginner always has some mistake here.e.g:Introductionchar s1[] = "Hello World";char *s2 = "Hello World";sizeofs1:12 // s1 is a arraysizeofs2:4 / 阅读全文
posted @ 2012-10-27 11:34 jeremyatchina 阅读(261) 评论(0) 推荐(0) 编辑
摘要: [Linux] 使用 SCP 指令,讓您傳送檔案至遠端、下載檔案當我們使用 Linux 系統時,可能需要一些傳送檔案的動作,此時就可以使用 SCP 這個指令,即可不須透過隨身碟等方式,幫你將檔案傳送至另一端 Linux 電腦~接著我們看看如何使用~~假設我們有兩台電腦…..A電腦 IP : 1.1.1.1B電腦 IP : 1.1.1.2[上傳]若目前使用A電腦,我們要將 A電腦 某個檔案,傳送至 B電腦 中,可以這麼輸入scp[-P Port][-pr] [-l 速度] [傳送至遠端的檔案] [遠端帳號@IP:放置的路徑]ex. scp -P 1234 -pr/home/user/temp/ 阅读全文
posted @ 2012-10-26 20:31 jeremyatchina 阅读(331) 评论(0) 推荐(0) 编辑
摘要: ;hello.asm[SECTION .text]global _start_start: jmp short ender starter: xor eax, eax ;clean up the registers xor ebx, ebx xor edx, edx xor ecx, ecx mov al, 4 ;syscall write mov bl, 1 ;stdout is 1 pop ecx ;get the address of the string from the stack mov dl, 5 ;length of the string int 0x80 xor eax, e 阅读全文
posted @ 2012-10-26 20:09 jeremyatchina 阅读(251) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int doAdd(int a, int b) { return a + b; }int doMinus(int a, int b) { return a - b; }int test(int a,int b,int (*suck)(int,int)) {return suck(a,b);}int main(void) {int (*my_func_ptr)(int, int);my_func_ptr = doAdd;printf("function pointer to doAdd => %d\n", (*my_fun 阅读全文
posted @ 2012-10-19 02:17 jeremyatchina 阅读(256) 评论(0) 推荐(0) 编辑
摘要: // victim.c#include <stdio.h>int main(int argc,char *argv[]){char little_array[512]; strcpy(little_array,argv[1]); printf("Your enter:\n%s\n",little_array); return 0;}gcc -fno-stack-protector -z execstack -mpreferred-stack-boundary=2 -o victim -g victim.c./victim `perl -e 'pr... 阅读全文
posted @ 2012-10-08 21:51 jeremyatchina 阅读(152) 评论(0) 推荐(0) 编辑
摘要: turn off ASLR in linuxQ: I want to turn off ASLR on my own PC. But each time I type "sudo echo 0 > /proc/sys/kernel/randomize_va_space", the system shows that "Permission denied". How can I make it work? By the way, my OS kernel is 2.6.30.A:This is a common problem with sudo a 阅读全文
posted @ 2012-10-03 17:39 jeremyatchina 阅读(219) 评论(0) 推荐(0) 编辑
摘要: http://www.rustyrazorblade.com/2010/12/virtualbox-4-nat-port-forwarding-gui/http://www.aoddy.com/2011/08/01/ssh-a-guest-server-in-virtualbox-by-port-forwarding//etc/init.d/network restart 重啟網路設定lspci查看,網路卡是抓到? 阅读全文
posted @ 2012-09-29 20:38 jeremyatchina 阅读(206) 评论(0) 推荐(0) 编辑