質問編集履歴

5

興奮してstringがStringになってたので修正

2018/01/23 00:12

投稿

notgoodpg
notgoodpg

スコア37

test CHANGED
File without changes
test CHANGED
@@ -106,7 +106,7 @@
106
106
 
107
107
  #endif
108
108
 
109
- std::String s( rtnValue.begin(), rtnValue.end());
109
+ std::string s( rtnValue.begin(), rtnValue.end());
110
110
 
111
111
 
112
112
 

4

a

2018/01/23 00:12

投稿

notgoodpg
notgoodpg

スコア37

test CHANGED
File without changes
test CHANGED
@@ -78,7 +78,7 @@
78
78
 
79
79
  // TCHAR -> char
80
80
 
81
- std::vector<char> MyCommon::TCHARArrayToCharVector( TCHAR *src)
81
+ std::string MyCommon::TCHARArrayToString( TCHAR *src)
82
82
 
83
83
  {
84
84
 
@@ -106,9 +106,11 @@
106
106
 
107
107
  #endif
108
108
 
109
+ std::String s( rtnValue.begin(), rtnValue.end());
109
110
 
110
111
 
112
+
111
- return rtnValue;
113
+ return s;
112
114
 
113
115
  }
114
116
 

3

怒りの追記

2018/01/22 08:32

投稿

notgoodpg
notgoodpg

スコア37

test CHANGED
File without changes
test CHANGED
@@ -63,3 +63,53 @@
63
63
 
64
64
 
65
65
  __ベストアンサーには問題を解決できる内容の回答を最初に提示していただいた方を選択しています。__
66
+
67
+
68
+
69
+ ###ちなみに、LPCTSTR->std::stringしたい場合も多いですね!
70
+
71
+ こうしてます
72
+
73
+ 超絶めんどくさいです
74
+
75
+ 1行、20文字くらいで終わるいい方法知ってたら教えてください
76
+
77
+ ```c++
78
+
79
+ // TCHAR -> char
80
+
81
+ std::vector<char> MyCommon::TCHARArrayToCharVector( TCHAR *src)
82
+
83
+ {
84
+
85
+ std::vector<char> rtnValue;
86
+
87
+ #ifdef UNICODE
88
+
89
+ // デフォルトでUNICODEが選択されてるのに何でしょうこのめんどくささは。
90
+
91
+ // TCHAR -> char
92
+
93
+ char tcb[ MAX_PATH];
94
+
95
+ WideCharToMultiByte( CP_ACP, 0, src, -1, tcb, sizeof(tcb), NULL, NULL);
96
+
97
+
98
+
99
+ for(int i = 0; tcb[i] != '\0'; ++i) rtnValue.push_back( tcb[i]);
100
+
101
+ #else
102
+
103
+
104
+
105
+ for(int i = 0; tcb[i] != '\0'; ++i) rtnValue.push_back( src[i]);
106
+
107
+ #endif
108
+
109
+
110
+
111
+ return rtnValue;
112
+
113
+ }
114
+
115
+ ```

2

不明瞭な表記部分を修正

2018/01/22 08:25

投稿

notgoodpg
notgoodpg

スコア37

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,7 @@
32
32
 
33
33
  ```
34
34
 
35
- *Hogeはclassで、コンストラクタでメンバにstd::string型文字列を持たせてgetMessage()関数で文字列を取り出します。
35
+ *Hogeはclassで、コンストラクタでメンバにstd::string型文字列を持たせてgetMessage()関数でstd::string型文字列を取り出します。
36
36
 
37
37
  *IDC_EDIT1はEditBoxのIDです。
38
38
 

1

ベストアンサー選択に関するポリシー?を追加

2017/11/07 08:21

投稿

notgoodpg
notgoodpg

スコア37

test CHANGED
File without changes
test CHANGED
@@ -59,3 +59,7 @@
59
59
  - Windows7 Professional SP1 64bit
60
60
 
61
61
  - プロジェクトプロパティページ > 構成プロパティ > 文字セット > Unicode文字セットを使用する
62
+
63
+
64
+
65
+ __ベストアンサーには問題を解決できる内容の回答を最初に提示していただいた方を選択しています。__