can I open a file and then close it in a loop? I tried but it doesnt seem to work. :(

Depens on when you're interrested in loading and closing it; but something like this:

for (int a=0; a<=10;a++)
  {
  if (a==0){LOAD}
  // Some stuff
  if (a==10){CLOSE}
  }

Something like this?

can I open a file and then close it in a loop? I tried but it doesnt seem to work. :(

No, I dont think C/C++ allow you to use fopen/fclose in a loop. If you use Linux, try "man-ing" fopen for more info:

man 3 fopen

hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.