Here is the VC++ code

SVisFileDescriptor filedescriptor1;
		ZeroMemory(&filedescriptor1, sizeof(SVisFileDescriptor));
		filedescriptor1.has_alpha_channel=CVisImageBase::IsAlphaWritten();
		filedescriptor1.jpeg_quality=0;
		filedescriptor1.filename=currentpath1;
		pframe->SetTimer(22,5000,NULL);
		imageS1.WriteFile(filedescriptor1);

This block is basically replicated in 3 different functions which in essence save 1 image EACH from a camera connected. I am not sure why this is happening. But my hunch is there is an overlap in someway which is why it saves 1 image(well partly) and fails to save the other 2
Any help would be greatly appreciated.

Thanks,
Vivek

Recommended Answers

All 4 Replies

What's the error, and where is it happening?

Oh I apologize for that, I thought I had written that. There is an assertion error (Stream!=Null), and it stops in this code snippet I have posted above. The assertion window also mentions fclose.c as the filename.

Sorry, that's not enough information.

Please post the FULL, EXACT text of the mssage you're getting, along with the code surrounding the asssert statement that's failing.

Intuitively, I would guess that the problem is that you are attempting to close a file stream that was never opened or already closed (i.e. Stream == NULL causes the assertion failure during the closing of the file, in fclose()).

The ZeroMemory() part seems suspect too. In C++, it rarely is a good idea to just zero the memory because you should normally rely on constructors and RAII-style classes.

What are the data-members of SVisFileDescriptor?
What is imageS1? Where is it initialized? Used?
What does imageS1.WriteFile(filedescriptor1) do?

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.