[CString to string]

CString CfilePath=_T("abcavc");

std::string filePath((LPSTR)(LPCTSTR)CfilePath); <- 이렇게 했더니 제대로 안뜸!!!


CT2CA pszConvertedAnsiString (CfilePath);

std::string filePath(pszConvertedAnsiString);


과 같이 바꿔주어야 한다!



[string to CString]

std::string str = "Hello";

CString Cstr(str.c_str());

'프로그래밍 > C/C++' 카테고리의 다른 글

TCHAR  (0) 2012.05.09
[MFC] 폴더 지정 대화상자로 선택한 폴더 열기  (0) 2012.05.09
CString to double  (0) 2012.05.08
[MFC] edit control 사용 방법  (0) 2012.05.08
MFC tab controller  (0) 2012.04.30
Posted by halloRa
,

출처: http://www.tek-tips.com/viewthread.cfm?qid=1054010


CString test("1234.123");

double d = wcstod(test, NULL);

'프로그래밍 > C/C++' 카테고리의 다른 글

[MFC] 폴더 지정 대화상자로 선택한 폴더 열기  (0) 2012.05.09
[MFC] CString to String & String to CString  (0) 2012.05.09
[MFC] edit control 사용 방법  (0) 2012.05.08
MFC tab controller  (0) 2012.04.30
char to string  (0) 2012.04.24
Posted by halloRa
,

출처: http://hgun.tistory.com/entry/MFC-Edit-Control-%EC%82%AC%EC%9A%A9%EB%B0%A9%EB%B2%95 (값 불러오기)

출처: http://ewst.tistory.com/4 (변수 선언)


'프로그래밍 > C/C++' 카테고리의 다른 글

[MFC] CString to String & String to CString  (0) 2012.05.09
CString to double  (0) 2012.05.08
MFC tab controller  (0) 2012.04.30
char to string  (0) 2012.04.24
배열 초기화  (0) 2012.04.13
Posted by halloRa
,

출처: http://blog.naver.com/pjp3894?Redirect=Log&logNo=155705812


이 때 해당 추렃의 글을 그대로 따라하는 대신

tab 생성 순서를 반대로 해줘야

처음에 viewer가 떳을 때

해당 tab과 관련된 내용이 제대로 뜬다.

'프로그래밍 > C/C++' 카테고리의 다른 글

CString to double  (0) 2012.05.08
[MFC] edit control 사용 방법  (0) 2012.05.08
char to string  (0) 2012.04.24
배열 초기화  (0) 2012.04.13
반올림 함수  (0) 2012.03.28
Posted by halloRa
,

출처: http://blog.naver.com/lins77?Redirect=Log&logNo=140127163975


char c = 'A';

string s;

s += c;


=> s now has "A"

'프로그래밍 > C/C++' 카테고리의 다른 글

[MFC] edit control 사용 방법  (0) 2012.05.08
MFC tab controller  (0) 2012.04.30
배열 초기화  (0) 2012.04.13
반올림 함수  (0) 2012.03.28
Single char to int  (0) 2012.03.15
Posted by halloRa
,

배열 초기화 시에 index size 값은 항상 "상수" 만이 가능하다!

define 된 변수가 아닌 이상에서는

변수 자체를 index size로써 지정해 줄 수 없다!!!!!!!

NEVER!


출처: http://pinkwink.kr/201


그래서 index size를 미리 알 수 없을 경우 나 같은 경우에는 배열을 포기하고 vector 를 이용함

'프로그래밍 > C/C++' 카테고리의 다른 글

MFC tab controller  (0) 2012.04.30
char to string  (0) 2012.04.24
반올림 함수  (0) 2012.03.28
Single char to int  (0) 2012.03.15
C++에서 소문자, 대문자 바꾸기  (0) 2011.10.11
Posted by halloRa
,


$ sed -n '<start>, <end>p' <input file>


출처: http://pplane.net/i/entry/리눅스명령어-sed#_post_538

'프로그래밍 > LINUX' 카테고리의 다른 글

C++ 파일과 mysql++을 이용한 컴파일  (0) 2012.09.14
mysql++ 설치하기  (0) 2012.09.14
.bash_profile path 설정 시  (0) 2012.03.07
리눅스&MacOS 쉘 스크립트(*.sh) 실행 방법  (0) 2012.03.07
OS 별 Bit 확인 방법  (0) 2012.03.07
Posted by halloRa
,



#include <cmath>

double round(double d) { return floor(d + 0.005); }

그냥 이렇게만 했을 때 이 floor()라는 함수는 버림 함수-_- 그 것도 정수 상태로 만들어주는!!!!!!!!!!!!!!!!!!!!
그래서 그냥 이렇게 하면 소수점 이하는 다 버리게 되는 셈. 누가 이걸 올려 놓은거야?-_-

따라서 

double round(double d, int pos) 

double tmp;

tmp = d * pow(10.0, pos);

tmp = floor(tmp + 0.5);

tmp *= pow(10.0, -pos);

return tmp; 

}


와 같이 pow() 함수를 써서 실제 소수점을 가지는 값을 원하는 소수점까지 정수 값으로 만든 후에
floor() 함수를 써서 나머지를 버린 후
그 값을 다시 원래의 double 형태로 만들어 준 다음에 return 하는 방식을 사용하여야 한다.
이 때 pow(base, expoent) 함수의 경우 앞선 base 가 되는 값이 double 형태로 쓰여 있어야지 오류가 발생하지 않는다!

'프로그래밍 > C/C++' 카테고리의 다른 글

char to string  (0) 2012.04.24
배열 초기화  (0) 2012.04.13
Single char to int  (0) 2012.03.15
C++에서 소문자, 대문자 바꾸기  (0) 2011.10.11
getline(cin, temp);  (0) 2011.09.26
Posted by halloRa
,
char a = '1';
int b = a -'0'; 

출처: http://stackoverflow.com/questions/439573/how-to-convert-a-single-char-into-an-int 

'프로그래밍 > C/C++' 카테고리의 다른 글

배열 초기화  (0) 2012.04.13
반올림 함수  (0) 2012.03.28
C++에서 소문자, 대문자 바꾸기  (0) 2011.10.11
getline(cin, temp);  (0) 2011.09.26
Visual Studio 2010에서 콘솔 창이 바로 꺼질 때  (0) 2011.06.22
Posted by halloRa
,
리눅스 상에서 .bash_profile path를 설정할 때
$PATH:$HOME/bin 뒤에 덧붙일 경우
:<원하는 path 위치>로 하면 된다.  

[example]

PATH=$PATH:$HOME/bin:/myprog/new/
 
Posted by halloRa
,