I am trying to redirect a data file called data1 into my program, but I keep on getting a segmentation fault.
When I try ./w data1 then it reads it correctly but when I do ./w < data1 then the error pops up.
I have to use the second way for my assignment.
Here is what my code looks like:
int main(int argc, char *argv[])
{
FILE *Q;
Q = fopen(argv[1],"r");
}