반응형
프로그래밍 노트/C&C++2021. 7. 4. 18:00C 예제 - CSV 파일 읽기

CSV 파일을 줄단위로 읽어서 공백을 제거한 후, 컬럼 별로 나누어서 출력하는 예제입니다. 다음 3곳의 코드 참고하여 작성했습니다. https://stackoverflow.com/questions/12911299/read-csv-file-in-c https://stackoverflow.com/questions/1726302/removing-spaces-from-a-string-in-c https://www.ibm.com/docs/ko/i/7.3?topic=functions-strtok-tokenize-string 2021. 7. 3 최초작성 2021. 7. 4 컬럼 2개까지만 되는 버그 수정, 구조체로 결과 받아오도록 수정 #include #include #include #define MAX_DATA 3..

Android/SQLite2019. 2. 12. 14:18간단한 Android Sqlite 예제 ( DB생성,테이블 생성, 데이터 입력, 테이터 보여주기)

간단한 SQLite를 사용하는 예제 입니다.앱을 시작하면 데이터 베이스를 생성하고 names, phones 두개의 컬럼이 있는 테이블을 생성하고 데이터를 삽입합니다. 그리고 나서 테이블에서 데이터를 가져와 리스트뷰에 보여주는 예제입니다.. activity_main.xml파일입니다. 리스트뷰를 화면에 보여줍니다. list_item.xml은 listview 한줄에 여러 개의 항목을 보여주기 위해 필요한 레이아웃입니다. MainActivity.java는 자바 프로그램 코드 입니다. package com.tistory.webnautes.sqllite_example; import android.app.Activity; import android.os.Bundle; import java.util.ArrayList;..

openCV 라벨링 예제 ( connectedComponentsWithStats )
OpenCV/OpenCV 강좌2015. 11. 19. 15:57openCV 라벨링 예제 ( connectedComponentsWithStats )

두번째 예제에 있던 오타 및 오류를 잡았습니다. 테스트에 사용한 이미지입니다. openCV 3.0부터 라벨링 알고리즘이 추가되었습니다.. 이미지를 라벨링하고 원하는 라벨을 색으로 표현한다든가.. 각각의 영역들을 박스치는 것등이 쉽게되네요.. 해당 영역의 크기도 각각 계산되서 나옵니다.. 자세한건 아래 소스코드를 읽어 보세요... 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162#include #include #include #include #include using namespace cv; using namespace std; int main() {..

AVR 예제2– 세븐 세그먼트
AVR/Atmega128 강좌2015. 3. 2. 01:10AVR 예제2– 세븐 세그먼트

잘그리지 못하지만 그려봤습니다.. Cathode 타입 Anode 타입 아래 표는 Anode의 경우를 나타낸 것입니다. 회로도에 연결시 반대로 했으면 보기 편할뻔 했네요 abcdefg2진수0LOWLOWLOWLOWLOWLOWHIGH0b010000001HIGHLOWLOWHIGHHIGHHIGHHIGH0b011110012LOWLOWHIGHLOWLOWHIGHLOW0b001001003LOWLOWLOWLOWHIGHHIGHLOW0b001100004HIGHLOWLOWHIGHHIGHLOWLOW0b000110015LOWHIGHLOWLOWHIGHLOWLOW0b000100106LOWHIGHLOWLOWLOWLOWLOW0b000000107LOWLOWLOWHIGHHIGHLOWHIGH0b010110008LOWLOWLOWLOWLOWLOW..

AVR 예제 1 – LED 깜빡이기
AVR/Atmega128 강좌2015. 3. 1. 23:59AVR 예제 1 – LED 깜빡이기

#include #include int main(void) { //포트D를 출력으로 설정한다. DDRD = 0xFF; while (1) { //포트D의 값을 0xFF로 한다. LED가 켜진다. PORTD = 0xFF; _delay_ms(300); //300ms 대기 //포트D의 값을 0x00으로 한다. LED가 꺼진다. PORTD = 0x00; _delay_ms(300); //300ms 대기 } return 0; }

Raspberry Pi/Raspberry Pi 활용2015. 2. 22. 18:01리눅스 문자 디바이스 드라이버 예제

실행결과 응용 프로그램 simpleApp.c디바이스 드라이버 simple_dev.cdevice file open[13895.005913] openApp : write something life is good 12bytes[13895.009107] simple_write [13895.013561] DEV : read something [13895.018762] life is good 12bytesApp : read something life is good 12bytes[13895.023354] simple_read [13895.027854] DEV : write something [13895.033086] life is good 12bytesioctl function call ret = 0[13895.03..

리눅스 프레임버퍼 예제 1
OpenCV/미분류2015. 1. 27. 10:27리눅스 프레임버퍼 예제 1

콘솔에서 프레임버퍼에 색깔을 찍어본 예제입니다. X윈도우상에서도 결과를 보고 싶은데 안되네요. #include #include #include #include #include #include #include int main( int argc, char* argv[] ) { int framebuffer_fd = 0; struct fb_var_screeninfo framebuffer_variable_screeninfo; struct fb_fix_screeninfo framebuffer_fixed_screeninfo; framebuffer_fd = open( "/dev/fb0", O_RDWR ); if ( framebuffer_fd

미분류2013. 4. 26. 04:57SQLite C example

출처 http://nano-chicken.blogspot.kr/2012_08_01_archive.html http://snortbit.blog.163.com/blog/static/189573172201331593547914/ #include #include #include #include using namespace std; int main(int argc, char** argv) { sqlite3 *conn; sqlite3_stmt *statement; ⁄⁄ SQL Statement Object int ret = 0; int cols; ⁄⁄ This routine opens a connection to an SQLite database file ⁄⁄ and returns a database connec..

반응형
image