|
%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
1.나비 설치
$ sudo apt-get install nabi 2. ime 변경 $ im-switch -c 끝 참 쉽죠잉~!
ALSA라는 놈이 있다.. 리눅스에..
이놈은 마이크로 입력 받아서 처리하는 api, lib, application으로 되어있다. 보다 자세한 정보는 구글신에게 alsa로 검색하면된다. 그러면 http://www.alsa-project.org를 알려준다. 보다 자세한 샘플코드로 따라하기 하려면,, 비록 영어지만... 좀 쉽게 되어있다
기계식 키보드를 윈도우에서 사용하다보면, 윈도우 한영 변환이 않될 때가 있다..
이럴때는 이렇게.. ------------------------------- http://blog.naver.com/shinhj72?Redirect=Log&logNo=60045306752&jumpingVid=6072C86D29A12555201D0E43B701AF3439C3 ------------------------------- 이렇게 하면된다. 그럼. hangul_switch-shinhj72.zip
-------------------------------------------------------------------------
일단.. 이 문제의 확인은 gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) 에서 확인했음을 미리 밝힙니다. ------------------------------------------------------------------------- 자 이제 재미 있는 stl의 string의 버그(?)에 관해서 알아보자.. ------------------------------------------------------------ #include <string> #include <stdio.h> #include <string> #include <stdio.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #include <errno.h> using namespace std; int main() { string st1, st2, st3, label; st1 = "aaa bbb ccc "; st2 = st1; st3 = st1+" "; printf("st1: %x:%s<\n", st1.c_str(),st1.c_str() ); <----- 1) printf("st2: %x:%s<\n", st2.c_str(),st2.c_str() ); <----- 2) printf("st3: %x:%s<\n", st3.c_str(),st3.c_str() ); <----- 3) label = strtok((char*) st1.c_str(), " "); printf("st1: %x:%s<\n", st1.c_str(),st1.c_str() ); <----- 4) printf("st2: %x:%s<\n", st2.c_str(),st2.c_str() ); <----- 5) printf("st3: %x:%s<\n", st3.c_str(),st3.c_str() ); <----- 6) return 0; } ----------------------------------------------------------- 자 .. 여기서 1,2,3의 값은 각각 어떻게 될까?? 예상은 각각 모두 달라야 하지만.. 놀랍게도... 1,2는 동일한 번지를 가지고 있고 3번은 다른 값을 가지고 있다.. 1) st1: 25b6028:aaa bbb ccc 2) st2: 25b6028:aaa bbb ccc 3) st3: 25b6058:aaa bbb ccc 그리고 label = strtok((char*) st1.c_str(), " "); 이렇게 하면 어떻게될까?? 당연히 예상은 st1만 값이 변경되어야 하지만.... st2도 같이 변경된다. 4) st1: 25b6028:aaa 5) st2: 25b6028:aaa <---------------짜잔.. 6) st3: 25b6058:aaa bbb ccc 에게.. 이거 별거 아니네.. 하시는 분이 있을거다.. 분명이.. 나도 그러니까.. 그런데.. 다음의 상황을 보자.. 졸라 웃기게 된다. ------------------------------------------------------------ #include <string> #include <stdio.h> #include <string> #include <stdio.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #include <errno.h> using namespace std; void test( string aaa) <---------------------------------------------3) { label = strtok((char*) aaa.c_str(), " "); } int main() { string st1, st2, st3, label; st1 = "aaa bbb ccc "; printf("st1: %x:%s<\n", st1.c_str(),st1.c_str() ); <---------- 1) test( st1); printf("st1: %x:%s<\n", st1.c_str(),st1.c_str() ); <----------- 2) return 0; } ----------------------------------------------------------- 위의 소스는 test함수는 call by ref가 아니라 cal by value이다. 그럼... 당연히 1)과 2)의 값은 동일해야 한다. 그런데.. 결과는 ?? 1) st1: 251e028:aaa bbb ccc < 2) st1: 251e028:aaa< 다르다... 왜? void test( string aaa) <--- 이것은 string aaa=st1 이것을 내포하고 있다.. 따라서 위에처럼... aaa와 st1의 address는 동일하다.. 그러면.. 자동적으로 call by ref 처럼되어버린다. 이제.. 왜 이넘이 문제점이 되는지 이해가 되는지?? 자.. 이를 어떻게 해결하면되나?? 1. 번째.. strtok 를 사용하지 말자... 다른거 사용하자... google에서 c++ stl, string, tokenize로 검색하면 다른게 나온다. 2. 번째.. aaa = aaa + " " 이런거 추가해서.. c_str()의 포인터를 다르게 가져가자.. void test( string aaa) { aaa = aaa + " "; label = strtok((char*) aaa.c_str(), " "); } ----------------------------------- 자.. 결론.. c++, stl의 string은 --------------------------- st1 = "aaa bbb ccc "; st2 = st1; --------------------------- 이 상황에서는 s1과 s2의 내부적으로 포인터를 동일하게 가져가는것 같다. ( 아니면.. 포인터만 따로 가지고 있는데.. 그것이 update가 않될 수도 있다.) 주의하자..~~~!!!!
|
![]() by 멋진상수 카테고리
최근 등록된 덧글
set ts=4 sw=4 sts=4 ..
by 멋진상수 at 11/01 컴파일러 제작자들, 무.. by adnoctum at 09/27 c_str()의 결과에서 c.. by summerligh at 09/27 우분투 10.04 올라가면서 v.. by deven at 09/16 중복정의를 막기 위해 #p.. by 미친과학자 at 09/07 축하하오!!!! by 향기폴폴 at 12/12 제가 작성한 것 보다 훨씬.. by 멋진상수 at 09/30 아... 답변달아주셔서.. by 멋진상수 at 08/06 1. DC5700 모델은 모르.. by ydhoney at 07/25 블로깅 ㅋ 멋진 사진 많이.. by 정원형 at 03/20 태그
한영변환
줄바꿈
10.04
기계식키보드
FSA
defined
endif
썬더버드
txt
파일색깔
sound
라이트닝
TRIE
vi
u
bash_profile
string
cpp
linux
stl
class
c_str
define
윈도우
터미널
alsa
우분투
ubuntu
strtok
nfs
| |||