일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- pip
- JSON
- 핑거스타일
- mysql
- error
- Visual Studio
- ubuntu
- Linux
- OpenCV
- paramiko
- 컨테이너
- 채보
- VS Code
- C#
- 프로그래머스
- YOLO
- 기타 연주
- nvidia-smi
- Selenium
- pandas
- 오류
- C
- Python
- Docker
- windows forms
- label
- Numpy
- pytorch
- SSH
- C++
- Today
- Total
목록C (15)
기계는 거짓말하지 않는다
디렉터리를 생성한 후, 생성된 디렉터리의 소유권을 변경하고 싶다면 chown 함수를 사용하여디렉터리의 소유권을 변경할 수 있다. 아래는 예제 코드이며 UID, GID를 사용한다.unistd.h, sys/types.h 헤더 파일을 포함해야 한다.#include #include #include #include // UID, GID를 사용하여 소유권을 변경하는 함수int change_directory_ownership(const char* path, uid_t owner, gid_t group) { if (chown(path, owner, group) == -1) { perror("chown error"); return -1; } return 0;}int create_..
curl 라이브러리를 이용할 때 볼 수 있는 SSL 인증 관련 오류이다. 아래는 해결 방법들이다. SSL Disable Docs: CURLOPT_SSL_VERIFYPEER CURLOPT_SSL_VERIFYPEER CURLOPT_SSL_VERIFYPEER explained Name CURLOPT_SSL_VERIFYPEER - verify the peer's SSL certificate Synopsis #include CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYPEER, long verify); Description Pass a long as parameter to enable or disable. T curl.se 아래와 같이 SSL 인증을 di..
배열에서 분할 정복을 이용하여 최댓값을 찾는 예시이다.배열을 왼쪽, 오른쪽 반씩 나누고 왼쪽 반에서 최댓값을 재귀적으로 찾는다.오른쪽도 마찬가지 방법으로 반복한다.이렇게 왼쪽, 오른쪽에서 찾은 최댓값을 비교하여 더 큰 값을 최댓값으로 설정한다.최솟값 찾기는 부호의 방향만 바꾸어주면 된다.#include int find_max_index(int arr[], int left, int right) { if (left == right) // 배열 길이 1 return left; int mid = (left + right) / 2; int left_max_index, right_max_index; left_max_index = find_max_index(arr, left, mi..
C언어 파일 존재여부 확인 Linux #include if( access( f_path, F_OK ) != -1 ) { // 파일 존재 } else { // 파일 없음 } stat 구조체 이용 #include bool exist_file (char *file_name) { struct stat buffer; return (stat (file_name, &buffer) == 0); } FILE 구조체 이용 #include FILE *file; if (file = fopen("temp.txt", "r")) { fclose(file); printf("파일 존재\n"); } else { printf("파일 없음\n"); }
오름차순 Top-Down Merge Sort #include #include #include #define MAX_SIZE 100 void merge(int arr[], int temparr[], int lo, int mid, int hi) { int i, j, k; for (k = lo; k hi) arr[k] = temparr[i++];// lo ~ mid 전 까지 남은 배열 복사 (right 파트 확인 끝) else if (temparr[j] < temparr[i]) arr[k] = temparr[j++]; else arr[k] = temparr[i++]; } } void mergeSort(int arr[], int temparr[], int lo, int hi) { if (hi

기본 이진 검색 트리 Declaration #include #include typedef enum bool{ false, true } bool; typedef enum eSelectMenu { selectInsert = 1, selectDelete, selectPrint, selectExit } eSelectMenu; typedef struct Node { int key_value; int count; struct Node* parent; struct Node* left; struct Node* right; } Node; Insert, Delete Node void InsertNode(Node** root, int value) { Node* ptr, * parent; parent = ParentSearc..

우선순위에 따른 정렬이 가능하다. Declaration #include #define MAX_Q_SIZE 101 typedef enum bool{ false, true }bool; typedef enum eSelectMenu { selectPush = 1, selectPop, selectPeek, selectExit } eSelectMenu; typedef struct ProcessInfo {// 프로세스 정보 저장을 위한 구조체 int pid; int remainingJob; bool initialize; }ProcessInfo; int queueElement = 0;//현재 큐에 있는 프로세스 수 ProcessInfo pQueue[MAX_Q_SIZE];// 우선순위 큐 bool IsNew(int); ..