im having problems running this program. I have no compile errors but its saying
ID: 3631456 • Letter: I
Question
im having problems running this program. I have no compile errors but its saying ./a.out
no such file or directory and i dont know why. any help would be appreciated. The file im trying to open has EXACTLY 33 ints in it. how do i specify that in my header header file with #define?
#include "my.h"
#include
FILE* p;
int main(void)
{
int a[SIZE];
int x, i;
bool b, found;
int location;
int target;
p = fopen("myfile.dat","r");
for(i=1;x<=3; i++);
{
for(x=0; x<10; x++);
{
fscanf(p, "%d", &a[i]);
}
target = a[SIZE +1];
printme(SIZE, a);
oddvalues(SIZE, a);
oddlocations(SIZE, a);
countodd(SIZE, a);
addme(SIZE, a);
findsmall(SIZE, a);
findlarge(SIZE, a);
found = searchme(a, SIZE -1, target, &location);
sortme(a, SIZE-1);
b = binarysearch(a, SIZE-1, target,&location);
}
return;
}
i can show my function prototypes too but I'd rather do that in a private message ...
Explanation / Answer
To get the a.out file into the current working folder, you have to know where on the filesystem the program is in relation to your current working directory. In order to find out what your current working directory is, type:
pwd
in the terminal. That will tell you exactly where on your file system your current working directory is. Once you find out what that is, then you need to look for your file. Let's say, for example, that you're working in:
~/Desktop/C++/project1/source
And your a.out file is in:
~/Desktop/C++/project1/bin
Then the series of commands will be:
$ pwd
$ /Users/username/Desktop/C++/project1/source
$ ls ../bin
a.out
$ cp ../bin/a.out .
Then go ahead and try compiling again.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.