[過去ログ] C言語なら俺に聞け 152 (1002レス)
1-

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
671: (ワッチョイ 4f25-WSqd) 2019/07/23(火)03:25 ID:/ZO3BTO70(1/7)調 AAS
gchar **command = (gchar *[]){"./Hello.exe","World",NULL};

を gcc6 で compile すると以下の2種類の warning が出ます。

warning: ISO c++11 does not allow conversion from string literal to 'gchar *' (aka 'char *') [-Wwritable-strings]

warning: pointer is initialized by a temporary array, which will be destroyed at the end of the full-expression [-Waddress-of-array-temporary]

どう書くのが正解なのでしょうか? 教えてください。最後の NULL がなければ、

gchar **command = (gchar **)((char [][20]){"./Hello.exe","World"});

で良いと思うのですが、最後の NULL も必要です。よろしくお願いします。
1-
あと 331 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.022s