[問題] 從參數傳 separator 進 C 程式

作者: Neisseria (Neisseria)   2018-05-16 22:20:10
開發平台(Platform): (Ex: Win10, Linux, ...)
目前是 Mac,但類 Unix 系統應該都可以
使用 sh-compatible shell,Bash 或 Zsh
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
GCC 或 Clang
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)

問題(Question):
這有點偏特定系統問題,但牽涉到 C 實作,故在此板問
想要把 separator 傳入 C 程式中
[Update on 2018/05/17]
後來就造了一個輪子,自已解析 separator,效果如下:
$ ./sep_parse ' '
作者: a58524andy (a58524andy)   2018-05-17 00:40:00
$' ... 'Quoted string expansion.衮his construct expands single or multiple escaped octal or hex values intoASCII衞3]覔r袪nicodecharacters.https://goo.gl/rsBMpd
作者: AstralBrain   2018-05-17 01:35:00
這要看你用的是哪個shell相容性最高的寫法應該是 "$(printf '\t')"
作者: yvb   2018-05-17 12:57:00
'\t' 或 "\t" 的 \t 在 shell 下改按 CTRL-V TAB 可否?不過上述的幾種作法都無關 C 實作...或是你是求解把 -s 後的參數, 若看到 '\\' + 't' 轉成 '\t' ?

Links booklink

Contact Us: admin [ a t ] ucptt.com