Ok, I understand about \n. So should my code read:
int num, i = 0, read = 0, stop = 1;
FILE* fp;
fp = fopen(file, "r");
do{
fscanf(fp, "%d", &num);
Type: Posts; User: livestrng
Ok, I understand about \n. So should my code read:
int num, i = 0, read = 0, stop = 1;
FILE* fp;
fp = fopen(file, "r");
do{
fscanf(fp, "%d", &num);
It compiles, but when run:
./num5 num5.txt
It yields a Segmentation Fault.
And what do you mean by check fscanf? Should it not just read in the first line?
Hello, I'm trying to move the integers in a file to an array and order them. I'm almost positive that I can order them using a sorting method. However, I'm having trouble getting the integers from...