Creating window application in pure c on mac osx

前端 未结 5 1671
孤街浪徒
孤街浪徒 2020-12-24 08:33

I\'m creating an application in pure C on Mac OSX. What I want is to create window in witch my app will be stored.

Preferably I want it to be pure C solution, but if

5条回答
  •  猫巷女王i
    2020-12-24 08:38

    I'm creating an application in pure C on Mac OSX. What I want is to create window in which my app will be stored.

    Are you looking for a TTY window?

    If so does your application need to create the window?

    If not then you can simply write your pure C program and execute it from within Terminal - a TTY environment for "pure C".

    If you want a double-clickable app you can write an AppleScript which will open Terminal and run your C. Something like:

    tell application "Terminal"
       do script "ex /tmp/test; exit"
    end tell
    

    This opens a Terminal window showing "ex" and when that quits will terminate the shell process (so no further commands can be typed), but it will not close Terminal itself - for that you will have to work harder.

    If you do want you application to create the window itself you either need to write your own simple TTY window, you might find some classes you can use, or you might be able to borrow code from an open source terminal app such as iterm.

    HTH

提交回复
热议问题