1

In the tutorials of directfb, the link is Simple fullscreen application that draws a horizontal line

My question is why it return 23?

in ASCII, 23 means ETB, what's the reason to return ETB? It confuses me.

Thanks.

nonocast
  • 517
  • 4
  • 14
  • 1
    I suppose there is no special reason it returns 23. It could have been 42 also ... ;-) Anyway, per convention `EXIT_SUCCESS` (which equals to 0 in many cases) is return on success. – alk Oct 05 '12 at 14:52

1 Answers1

3

The main function of a C or C++ program should return an exit code to the operating system or its parent process. In that case, 23 is the exit code returned by this program.

Typically, returning 0 means success. Depending on the system, other exit codes may be "reserved" for special purposes, that is, they still can be used but may confuse the OS into believing the program ended incorrectly.

Exit codes are useful when running external programs and checking whether or not they completed successfully, or had any specific response. You'll have to refer to the specific program documentation to understand what each exit code means.

netcoder
  • 66,435
  • 19
  • 125
  • 142
  • that doesn't explain why it returned such a strange exit code. – Tom Tanner Oct 05 '12 at 16:54
  • @TomTanner: Yes, it does: it's application specific and OS specific. – netcoder Oct 05 '12 at 19:07
  • 1
    You've explained what it is doing. Now why it is returning 23. As opposed to 42. or 0, which would be more usual. – Tom Tanner Oct 08 '12 at 09:16
  • I think 'directfb' is a wellknown opensource project, it runs on linux. my friend says he really likes Michael Jordan. but i suppose not. – nonocast Oct 08 '12 at 13:50
  • @TomTanner: I guess the writer of this tutorial wanted to confuse people and have them ask questions on SO. What do I know why he returned 23? Why would you return 23 in your program? – netcoder Oct 08 '12 at 16:05