c programming printf terminal touch 2G

Discussion in 'iOS Development' started by egadzooks, Mar 27, 2009.

  1. egadzooks

    egadzooks New Member

    Joined:
    Mar 27, 2009
    Messages:
    5
    Likes Received:
    0
    im trying to do a bit of SIMPLE self taught c programming on the go using the terminal. I can write and compile just fine with gcc test.c -o test and then ./test but I am stuck on how to 'printf' out to the terminal. My code so far is


    #include<stdio.h>

    int main(){
    printf("hello world");
    }


    the stdio.h has the definition for printf, but nothing comes out of my program into the terminal. Is there some header file that has the command/code i am looking for?
  2. xDev

    xDev New Member

    Joined:
    Mar 21, 2009
    Messages:
    10
    Likes Received:
    0
    I don't know c but in c++ it is.
    Code:
    #include <iostream>
    using namespace std;
    
    int main()
    {
    cout << "Your Message";
    return 0;
    }
  3. Gman4354

    Gman4354 Member

    Joined:
    May 19, 2008
    Messages:
    718
    Likes Received:
    0
    Device:
    iPhone 4 (Black)
    Thats how you would write it in C on a Mac:

    Code:
    #include <stdio.h>
    
    int main (int argc, const char * argv[]) {
        printf("Hello, World!");
    }
    
  4. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    make sure you're signing it correctly, or else it will be killed.
  5. egadzooks

    egadzooks New Member

    Joined:
    Mar 27, 2009
    Messages:
    5
    Likes Received:
    0
    Found it

    After a bit more scouring of this forum I found the answer I was looking for

    http://www.ifans.com/forums/showthread.php?t=105119

    It is to perform an 'ldid -S Hello' on the file, a program that I have no clue about and will be learning after I post this. Thank you all for responding though.

    Please Register or Log in to view images

    Please Register or Log in to view images

    Please Register or Log in to view images

    Please Register or Log in to view images

    Please Register or Log in to view images

  6. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    yup, that's the signing tool.

Share This Page