본문 바로가기

Notice
Recent Posts
Recent Comments
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Tags
더보기
Archives
관리 메뉴

C++에서 String 출력하기 본문

C++

C++에서 String 출력하기

알광(Algwang) 2019. 1. 25. 10:38

1. cout 사용시


cout<<str<<endl;


2. printf 사용시


printf("%s\n",str.c_str());


c_str을 하지 않을 시 아래와 같이 이상한 값 나옴


+ 나중에 안 내용이지만 include한 string 헤더파일에 따라 다르게 나오는 듯 하다.

   정확한 차이는 아직 잘 모름 ㅠㅠ

Comments