[問題] C++有方法可以印出當下執行程式名稱嗎?

看板C_and_CPP (C/C++)作者 (科科:))時間11年前 (2014/12/02 14:35), 編輯推噓1(102)
留言3則, 3人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) Linux 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 請問c++有方法可以印出當下的執行程式名稱嗎? 像是 hello_world.cc 裡面加個function或其他可以直接印出 hello_world 隨後hello_world.cc 呼叫另一個檔案hello_taiwan.cc也可以印出 hello_taiwan 請問有相關可以使用的function或是方法嗎? 要菇狗也想不太到關鍵字 謝謝各位 :) 餵入的資料(Input): 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.116.187.212 ※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1417502122.A.35C.html

12/02 14:56, , 1F
__FILE__
12/02 14:56, 1F

12/02 15:48, , 2F
非常感謝!!! QQ
12/02 15:48, 2F

12/04 19:22, , 3F
printf("%s", argv[0]);
12/04 19:22, 3F
文章代碼(AID): #1KVLsgDS (C_and_CPP)
文章代碼(AID): #1KVLsgDS (C_and_CPP)