c++ - Why can't I read some BMP files? -


I am writing an application with a very simple purpose: select a bitmap directory and create an AVI video. I am using Rene Nefenegger's "AV CPP / AVIH" source code to add the BAP frame to the avi file. I am using the title "dirent.h" to "stream" the file names in my application. So far and with some small bugs, this application works very well, except that when there are several thousand bitmap files in a directory, the bitmap names and pixels are identical except for content, so I'm a bit confused. Here is the code snippet from inside the loop, which writes bitmaps in the AVI file.

  debews section; Bitmap BMP (bmpFileName.c_str ()); // bitmap object file is created with name int sbm = :: GetObject (BMP, size, and dibs); // If the size of the BMP object (SB! = Psychophage (debasection))) {// Writing error / bitmap file // To exit from writing code / file / file will be an error in writing in AII file if this case I have a coat in the console, which tells me that when every 5th frame is written in the AVI file, That's all I can keep track of. Around 2950's frame (different each time), it enters the error section of the "if" statement, I can verify that the name of the bitmap file is correct by setting a breakpoint. The following "time" loop has tried to see whether starting a bitmap again will eventually return a good value to SBM:  
 < Code> division discs; Bitmap BMP (bmpFileName.c_str ()); // bitmap object filename is created from int sbm = :: GetObject (BMP, size, and dibs); // BMP object size while (SBM! = Size)) {bitmap tryAgain (bmpFileName.c_str ()); Sbm = :: GetObject (BMP, size (dibs), and amp; dibs); // BMP object size if (SBM == size (DIBSEC)) {BMP = TriGen; Of /}>  

Finally, during the loop will work, and the frame will be added to the AVI file, but it will be with the next file, and the next, and the next, otherwise rather quick process Weight add I will summarize:

- When a directory to Read this program is fully worked perfectly in 2950 th file in the directory by using it as a frame bitmap files -The point On, Itmap object is invalid even though it was early with a string that indicates a valid file on the hard drive (like all previous ones). Using a loop for a while, I can finally create a valid bitmap object, but it adds a lot of time to be practical.

I am looking for some insights why it is that the file in the 2950 directory is there any way around it, and / or a better library / header to use for this purpose? I have very little formal programming, as is obvious in my code / approach, but I appreciate the help.

Credit for fixing Rodrigo! Using:

 : deleted object (BMP);  

Memory usage after adding each frame, which results in up to 10,000K (seen in the Task Manager). I'm sure I can clean it somewhere else and I can also use less memory.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -