C관련Etc...

c 2021. 6. 17. 11:40

01) Endian check
int endian(void)
{
int i = 0x00000001;

if (((char*)&i)[0])
return LITTLE_ENDIAN;
else
return BIG_ENDIAN;
}

02) .h파일 만들기
#ifndef __FILE_NAME_H__
#define __FILE_NAME_H__

#ifdef __cplusplus
extern "C"{
#endif

#define SYS_ENDIAN_BIG 0
#define SYS_ENDIAN_LITTLE 1

int endian(void);

#ifdef __cplusplus
}
#endif

#endif

03) 헤더파일은 컴파일 되는 것이 아니라 .c가 컴파일 되기 전에 전처리과정을 중 소스 내에 필요한 내용을 삽입하는 역할을 한다. 다만 global 변수를 헤더파일에 선언할 경우, 여러 소스파일에서 해당 변수를 사용할 때 컴파일러는 하나의 변수로 link하지 못하고 중복선언으로 알게된다. 따라서 초기화할 소스파일(.c)에서 선언을 하고 다른 소스파일에서는 extern으로 변수를 가져와서 사용해야 한다  
04) typedef
typedef가 하는 일은 기존의 Data형으로 새로운 Data형을 만드는 것.

Posted by afewgood
,

libpng warning: 해결방법

etc 2021. 6. 17. 11:01

libpng warning: iCCP: known incorrect sRGB profile
포토샵 실행 --> 이미지파일(.png) 열기
편집(Edit) --> 프로파일 할당(Assign Profile)... --> 이 문서의 색상관리 안함(Don't Color Manage This Document) 선택


libpng warning: Interlace handling should be turned on when using png_read_image
https://pixlr.com/kr/e/ 사이트에서 PNG 파일 새로 저장

'etc' 카테고리의 다른 글

SK브로드밴드 H614G 모뎀 설정  (0) 2021.07.20
VirtualBox 관련  (0) 2021.07.19
VirtualBox Guest OS 바로가기 생성  (0) 2019.12.26
openssl을 이용한 RSA 개인키 공개키 생성  (0) 2019.11.12
CR(Carriage Return) / LF(Line Feed)  (0) 2019.09.04
Posted by afewgood
,

[Dart] 진법변환

flutter & dart 2021. 6. 16. 23:38

import "dart:math";

void main() {

//진법변환 (10진수를 16진수로)
int decimal = 64435;
String convHex = decimal.toRadixString(16);
print(convHex);

//진법변환 (16진수를 10진수로)
final fullString = "001479B70054DB6E001475B3";
for(int i=0; i<=fullString.length-8; i+=8) {
final hex = fullString.substring(i, i+8);
final number = int.parse(hex, radix: 16);
print(number);
}

}

Posted by afewgood
,