본문 바로가기

반응형

C/Reference

(27)
[C] Command Prompt(명령 프롬프트) 창 띄우지 않고 명령어 실행 #include #include namespace EXEC_COMMAND{ namespace RETURN { namespace FAILURE { const int CREATE_PIPE = 1; const int CREATE_PROCESS = 2; } }}int ExecCommand(std::string command, std::string& output);int main(){ std::string output; ExecCommand("ping -n 1 142.251.42.164", output); std::cout
Integrity Level SID 값 const char * const INTEGRITY_LEVEL_SID_UNTRUSTED = "S-1-16-0";const char * const INTEGRITY_LEVEL_SID_BELOW_LOW = "S-1-16-2048";const char * const INTEGRITY_LEVEL_SID_LOW = "S-1-16-4096";const char * const INTEGRITY_LEVEL_SID_MEDIUM_LOW = "S-1-16-6144";const char * const INTEGRITY_LEVEL_SID_MEDIUM = "S-1-16-8192";const char * const INTEGRITY_LEVEL_SID_HIGH = "S-1-16-12288";const char * const I..
[C] 연산자 우선순위 https://msdn.microsoft.com/ko-kr/library/2bxt6kc4.aspx Precedence and order of evaluationLearn more about: Precedence and order of evaluationlearn.microsoft.com동일 순위끼리 봤을 때, 왼쪽에 있는 것이 더 순위가 높다.(expr++가 *보다 우선순위가 높다) int *a;int b = 3;a = &b;*a++; // *(a++)과 같은 결과다!!!
[C] C언어의 지시어(헤더파일, 전처리, 매크로) 미리 정의된 매크로https://docs.microsoft.com/ko-kr/cpp/preprocessor/predefined-macros?view=msvc-160 미리 정의된 매크로Microsoft C++ 컴파일러의 미리 정의된 전처리기 매크로가 나열 및 설명되어 있습니다.learn.microsoft.com// 미리 정의된 include 폴더에서 파일을 찾는다.#include // 현재의 소스 코드가 저장되어 있는 폴더에서 먼저 찾고, 파일이 없다면 미리 정의된 include 폴더에서 파일을 찾는다.#include "파일이름"// 컴파일러 오류 메시지를 발생.#error// 파일을 추가한다.#import// Else if#elif// Else#else// 식별자가 정의되어 있지 않으면 참.#ifndef..
[C] 서식 변환 문자열 https://learn.microsoft.com/ko-kr/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-170 형식 사양 구문: 'printf' 및 'wprintf' 함수Microsoft C 런타임 'printf' 및 'wprintf' 함수의 형식 지정자 구문을 설명합니다.learn.microsoft.com https://msdn.microsoft.com/ko-kr/library/56e442dc.aspx Format Specification Syntax: `printf` and `wprintf` FunctionsDescribes the format specifier syntax for th..
[C] 난수 생성 #include #include srand((unsigned int)time(NULL)); // 이 코드는 함수에 한번만 써주면 됨num = rand() % 100 ; // 0~99의 난수를 생성num = rand() % 10; // 0~9의 난수를 생성
[C] 시간 지연 // windows.h 헤더 파일 필요.#include // 시간 단위는 ms.Sleep(1000); // Sleep(1000);은 1초Sleep(10000); // Sleep(10000);은 10초
[C] 2차원 배열 동적 할당 #define ROW 3#define COL 4char **ptr = NULL;ptr = (char**)malloc(sizeof(char*) * ROW); // 포인터 배열 개수 (행의 개수)*ptr = (char*)malloc(sizeof(char) * (ROW * COL)); // 2차원 배열 총 개수for(i = 1; i

반응형