0
Answer

.net compact framework using File stream problem

renexavier

renexavier

19y
2.2k
1
This is about c# .net compact framework problem. I want to change a jpg file in the pocket pc 2002 emulator to be a byte array and then pass it via web service for furhter processing. I use the FileStream codes to convert the jpg to byte array as below, when an button onclick event. As FileStream is supported by .net compact framework. string strFullPath = @"\\Program Files\myApp\a.jpg"; // this is a file that must exist in above emulator folder. ln1: FileStream oImg = new FileStream (strFullPath,FileMode.Open,FileAccess.Read); ln2: BinaryReader oBinaryReader = new BinaryReader(oImg); ln3: byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length); ln4: oBinaryReader.Close(); ln5: oImg.Close(); However, every time when running ln1, IO exception occured and the emulator display error message "A device with the same name is already on the network. Tap Start > Settings > System tab > About > Device ID tab, change your device name, and try again" Any idea? Thanks much!!! Rene Xavier