Serial camera output

Hello
i have a simple code :


sdCard.MountSDCard();
serCam.StartStreaming();
 byte[] data = serCam.dataImage;
 string name = "img.bmp";
 sdCard.GetStorageDevice().WriteFile(name, data);
 serCam.StopStreaming();
 sdCard.UnmountSDCard();

the img.bmp file will be saved on sd card in 13Kb, but usually I receive error about damaged file "windows ca not open the file , it is damaged or …"
can eanybody help me?
thanks

Please see the note about flush all here
https://www.ghielectronics.com/docs/51/accessing-folders-and-files

maybe you have to test the [quote]isNewImageReady[/quote] property

thanks for answers
It seems that the problem is not about writing byte array on sd card.
the property of :


always return FALSE !!!!
apart from that, I've read this note : 
https://www.ghielectronics.com/docs/176/serial-camera-module
but i don't have this methods :

```cs]https://www.ghielectronics.com/docs/176/serial-camera-module[/code

Is it in a new version of .net micro framework?

sorry for mistake, It is the mentioned code :

the name of the file is wrong? It should begin with \SD… ?

Thanks very much for your attentions…
I’m using net micro framework sdk 4.2
Is that method just for sdk ver 4.3?
Mike : I’'m writing the file on sd and I can see it when I connect sd to my pc. Ut when i want to open it, I recieve that error

@ andre.m -

I’ve installed sdk ver 4.3, but, I can’t still see that method…

@ VB-Daniel -
That method always return false!!!