0

I have a C program (addfilexcode.c) that compiles and runs perfectly fine on terminal.

  1. Does anyone know how to add a simple text file (i.e. sched.txt) on to Xcode so I can run my C program on this sched.txt?
    I tried adding it into the "Products" folder already and it did not work.

  2. Do I need a certain command on my C program to have it specifically go through this sched.txt file in Xcode?

addfilexcode.c:

/* purpose: filters some data replacing semicolons with tab chars
   input: text
   output: text with tabs in place of semicolons */

int main(){
    int c;  
    while( (c = getchar()) != EOF )
    {
        if ( c == ';' ) c = '\t';   /* replace */
        putchar(c);     /* send to output */
    }
    return 0;
}
Spikatrix
  • 20,225
  • 7
  • 37
  • 83
  • 1
    http://stackoverflow.com/questions/7629886/how-can-i-pipe-stdin-from-a-file-to-the-executable-in-xcode-4 – kaylum Sep 20 '15 at 06:18
  • 3
    Not helpful because you tried it and it doesn't work? Or because you don't understand how it applies? Or..? – kaylum Sep 20 '15 at 06:23
  • Hey alan, sorry, I should be more explicit it says permission denied on my terminal when I tried to pipe it. Any ideas about what I can do? Thanks! – originalmountaindew Sep 20 '15 at 20:44

0 Answers0