Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

Can you do a fscanf inside of a for loop? for example: for(i=0;fscanf(input, "%c", &dummy) != EOF;i++)

Computer Science
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Join Brainly to access

this expert answer

SIGN UP FOR FREE
yes
okay thanks! I will test it out in my program
Did it work?

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

yeah slightly...its in a larger program of mine so i think the i++ in the for loop is messing things up. I might have to keep it in a while loop instead
I took the i++ out and it works great now. Thanks again
Seems like a while loop would be more appropriate. You're not using a loop variable, so the for loop doesn't buy you anything. These loops are equivalent: for (a; b; c) ; a; while (b) c; Well, mostly equivalent. In some languages a variable declared in the "a" statement in the for loop won't survive past the for statement body. In the while loop it will. The for loop just gathers the a, b, and c statements together into one neat package so they're conceptually easier to process as a unit.
If you're sure that there's data, a do while construct may be the best choice: do { fscanf(); } while( !feof);

Not the answer you are looking for?

Search for more explanations.

Ask your own question