본문 바로가기

소프트웨어/Linux/Device Driver

rasp] test module

#include<stdio.h>


void fcn(int, int, int);


int main() {


        printf("hello\n");


        while(1) {

                int front,rear,rotate;

                scanf("%d %d %d",&front, &rear, &rotate); getchar();

                fcn(front, rear, rotate);

        }


        return 0;

}


void fcn(int front, int rear, int rotate) {

        //mansung, test print

        printf("in [front,rear,rotate]=[%d,%d,%d]\n",front, rear, rotate);

        //ex) 1 0 30 => go, rot30


        //do


}

--------------------------------------------------------------


파일만드는법.

터미널키고

vi test_module.cpp

로 vi를키고

소스를 붙여넣는다.

그 후 esc를 누르고

:wq! 를 눌러서 저장하고 강제종료한다.

그다음 gcc -o test_module test_module.cpp 를하면 

test_module 실행파일이 만들어진다.

./test_module

을하면 프로그램이 실행되고

세개의 입력변수를 입력한다.

ex) 1 0 30


종료ㅕ하려면 ctrl+c