하부 함수에 하지 말고 main 에서 signal 설정



excel 2 wiki

카테고리 없음 2013. 11. 12. 17:20

char * foo() {

static char ret[];

return (ret);

}

등의 코드를 검토한 글

http://www.eskimo.com/~scs/cclass/int/sx5.html 


ioctl(2046, TCGETA, 0x7f7f3e48)                                                        ERR#25 ENOTTY

write(2046, "B D 2 0 1 3 0 9 0 2 2 0 1 3 0 9 ".., 327)                                 = 327

open("result.out", O_WRONLY|O_APPEND|O_CREAT, 0666)                                         = 2047

lseek(2047, 0, SEEK_END)                                                               = 1337430

socket(AF_INET, SOCK_STREAM, 0)                                                        ERR#24 EMFILE

  Received signal 11, SIGSEGV, in user mode, [SIG_DFL], partial siginfo

    Siginfo: si_code: I_NONEXIST, faulting address: 0xd66e3d90, si_errno: 0

    PC: 0xc004e00b, instruction: 0x45810000

exit(11) [implicit]


fopen 후 fclose 를 하지 않아 에러가 난 truss

2048 번째 fd 를 초과하면서 죽는 모습을 볼 수 있다


csh

카테고리 없음 2013. 11. 6. 14:51

1. alias 설정

* vi .cshrc ; source .cshrc)

cdabc 'cd /dir1/dir2/abc'


2. 이전 명령 반복

%  !!


3. 히스토리 변경

% set history=100
% echo $history
100


4. 이전 명령어의 일부로 실행

% ?c123

% proc123d

% proc123d started ...


5. alias 등록

.chsrc 에 등록 후 source .cshrc


출처:http://www.gnu.org/software/libc/manual/html_node/Elapsed-Time.html


#include <stdio.h>

#include <sys/time.h>



int main()

{

    int i;

    int ret;


    struct timeval before , after, result;


    gettimeofday(&before , NULL);


    //Time taking task

    for (i=1 ; i <= 100 ; i++)

    {

        printf("%d %d %d n",i, i*i, i*i*i);

        usleep(i);

    }


    gettimeofday(&after , NULL);


    ret = timeval_subtract(&result, &after , &before);

    printf("ret=%d\n", ret);

    printf("\n[%d] sec ", result.tv_sec);

    printf("[%d] usec \n", result.tv_usec);


    return 0;

}


inttimeval_subtract (result, x, y)

  struct timeval *result, *x, *y;

{

/* Perform the carry for the later subtraction by updating y. */

if (x->tv_usec < y->tv_usec) {

int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;

y->tv_usec -= 1000000 * nsec;

y->tv_sec += nsec;

}

if (x->tv_usec - y->tv_usec > 1000000) {

int nsec = (x->tv_usec - y->tv_usec) / 1000000;

y->tv_usec += 1000000 * nsec;

y->tv_sec -= nsec;

}


/* Compute the time remaining to wait.

tv_usec is certainly positive. */

result->tv_sec = x->tv_sec - y->tv_sec;

result->tv_usec = x->tv_usec - y->tv_usec;


/* Return 1 if result is negative. */

return x->tv_sec < y->tv_sec;

}


<SCRIPT LANGUAGE="JAVASCRIPT">

function IsHangul(korname)

{

var temp="";

var len;

var found = false;

console.log("korname:" + korname);

console.log("korname.length:" + korname.length);

for(k=0; k<korname.length; k++)

{

temp=korname.charAt(k);

len = 0;

len = escape(temp).length;

console.log("temp:" + temp);

console.log("len:" + len);

if(len > 4)

{

found = true;;

break;

}

}


return (found);

}


if (IsHangul("가나다"))

{

console.log("한글");

}

else

{

console.log("한글 아님");

}

</SCRIPT>




Setup > Terminal  메뉴에서


coding[receive]:KS5601

coding[transmit]KS5601:

locale:korean

CodePage:949




netstat -an|find "10001"

10001 번 포트를 찾을 때


readLine() 을 사용할 수 없는 경우이다.

원 출처는 http://javacan.tistory.com/entry/35



InputStream is;

is = connectionSocket.getInputStream();

String msgBodyStr = "";


BufferedReader br = new BufferedReader(new InputStreamReader(is));

char[] buffBody = new char[1024];

int len = -1;

int sumLen = 0;

while ((len = br.read(buffBody)) != -1){   // br.read(buffBody,0,1); 도 가능

msgBodyStr += new String(buffBodym0, len);

sumLen += len;

if (sumL > = msgBodyLen){

break;

}

}