Xcode (C) "Check dependencies" and "Error: Executable doesn't exist" -


i'm doing school project in c using xcode. task create command line application checks if , how many times word appears in text file. far i've created first step of code, have set first argue argument "hej" though im not using word yet, , because of first filename not entered , therefore null, have set existing file called "hej.txt", in order test code go.

this bit worked before:

#include "stdio.h" #include "string.h"   struct filesearch {     char *infile;     char *outfile;     char *searchword; };  int main(int argc, char *argv[]) {      int index = 0;     struct filesearch f;     f.searchword = argv[1];     file *searchfile;      //for-loop assign filenames     for(index = 0; index < argc ; ++index)     {         if((strcmp(argv[index], "-i") == 0) && argv[index] != null && strcmp(argv[index + 1], "-o") != 0)         {             f.infile = argv[index + 1];         }         if((strcmp(argv[index], "-o") == 0) && argv[index] != null && strcmp(argv[index + 1], "-c") != 0)         {             f.outfile = argv[index + 1];         }     }      if (f.searchword == null)     {         printf("you didnt enter search word");     }      if (f.infile == null)     {         f.infile = "hej.txt";     }       if (f.outfile == null)     {         f.outfile = "stdout.txt";     }      printf("%s & %s & %s", f.searchword, f.infile, f.outfile);     return 0; } 

it printed out search word, input filename , output filename.

then added next step of code open text file "hej.txt" , read strings , print them.

#include "stdio.h" #include "string.h"   struct filesearch {     char *infile;     char *outfile;     char *searchword; };  int main(int argc, char *argv[]) {      int index = 0;     struct filesearch f;     f.searchword = argv[1];     file *searchfile;      //for-loop assign filenames     for(index = 0; index < argc ; ++index)     {         if((strcmp(argv[index], "-i") == 0) && argv[index] != null && strcmp(argv[index + 1], "-o") != 0)         {             f.infile = argv[index + 1];         }         if((strcmp(argv[index], "-o") == 0) && argv[index] != null && strcmp(argv[index + 1], "-c") != 0)         {             f.outfile = argv[index + 1];         }     }      if (f.searchword == null)     {         printf("you didnt enter search word");     }      if (f.infile == null)     {         f.infile = "hej.txt";     }       if (f.outfile == null)     {         f.outfile = "stdout.txt";     }      printf("%s & %s & %s", f.searchword, f.infile, f.outfile);      //open file , read     char str[60];      searchfile = fopen(f.infile, "r");     if(searchfile = fopen(f.infile, "r") == null)     {         printf("error: there no file name.");         return -1;     }      if(searchfile == null)     {         printf("the file empty");         return -1;     }      while(fgets(str, 60, searchfile) != null)     {         puts(str);     }      fclose(searchfile);      return 0; } 

however builds code when try run it, error message:

"error: executable doesn't exist: '/users/slattegard/library/developer/xcode/deriveddata/coursework-chwsqczjjgxcyegnxgysiaigslvq/build/products/debug/coursework' error: failed launch '/users/slattegard/library/developer/xcode/deriveddata/coursework-chwsqczjjgxcyegnxgysiaigslvq/build/products/debug/coursework'"

and issue navigator gives me message:

"check dependencies warning: no rule process file '/users/slattegard/documents/coursework/coursework/find.c' of type sourcecode.c architecture x86_64"

anyone know going wrong?


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -