Hello, If performance is criticle, just leave the file open; open before the loop, read in data, close the file. Don't open and close for every read.
Thanks, Tyler Littlefield Web: tysdomain.com email: [email protected] My programs don't have bugs, they're called randomly added features. ----- Original Message ----- From: "glogic20" <[email protected]> To: <[email protected]> Sent: Monday, June 01, 2009 10:21 AM Subject: [c-prog] File IO Hey all Just a query on file IO. Im writing code that takes data from a text file that updates the positions of my 3d models on a frame per frame basis(.bvh). I am currently writing code that reads in new line each frame (each new line contains new frame data) but i am currently opening the file each frame retrieving the line i need and closing it again. As im learning from tutorials that all show closing the file each time u have taken what you need within a game loop. I know its a stupid question but i just want to know if there is any danger in having a text file opened for the length of the animation.i.e i open it when i load up my .bvh file and then just read from it each frame and close it once i read the end of file. Im writing it in C++ and i dont need any code just need to understand/know if there is any dangers in just leaving the file open in code that i should be aware of in future coding. Thanks G
