본문 바로가기

C 언어138

공유(shared) 라이브러리 만들기 공유(shared) 라이브러리 만들기 http://www.darknet.org.uk/2016/07/dmitry-deepmagic-information-gathering-tool/ 부제 : dmitry 소스 쪼개서 사용하기 file.h #include #include #include #define OUTPUT_LOCALITY "output.txt" FILE *wfp; fpos_t file_loc; char filename[64]; char outputfile[64]; int file_prep(); int file_open(); int file_close(); file.c #include "file.h" int file_prep() { outputfile[strlen(outputfile)] = '\0'; i.. 2016. 7. 19.
정적 라이브러리 만들기 정적 라이브러리 만들기http://www.darknet.org.uk/2016/07/dmitry-deepmagic-information-gathering-tool/부제 : dmitry 소스 쪼개서 사용하기 tcp_sock.h #include #include #include #include #include #include #include #define MAX_TCP_CON 9 #define MAX_PART 20 #define STD_MSN_PORT 1863 struct sockaddr_in sock; /* Structure for socket address */ long address; /* Remote IP (4 octet) address */ struct hostent *ph; int tcp_sock; .. 2016. 7. 19.
copy file copy file 1. 소스 #include #include int main() { char ch; char source_file[20] = "source.txt"; char target_file[20] = "target.txt"; FILE *source, *target; source = fopen(source_file, "r"); if( source == NULL ) { exit(EXIT_FAILURE); } target = fopen(target_file, "w"); if( target == NULL ) { fclose(source); exit(EXIT_FAILURE); } while( ( ch = fgetc(source) ) != EOF ) fputc(ch, target); printf("File .. 2016. 7. 12.
binary search binary search 1.소스 #include int main() { int c, first, last, middle, n, search, array[100]; printf("Enter number of elements\n"); scanf("%d",&n); printf("Enter %d integers\n", n); for (c = 0; c < n; c++) scanf("%d",&array[c]); printf("Enter value to find\n"); scanf("%d", &search); first = 0; last = n - 1; middle = (first+last)/2; while (first last) printf("Not found! %d is not present in the lis.. 2016. 7. 12.