Windows Mobile 5.0 file read/write

Hi,

I am porting one of my application from Pocket PC 2003 to windows mobile 5.0. Since I want it on botht platforms I am building it using eVC++ 4.0 SP4 with Pocket PC 2003 as the platform.

My app runs perfectly well on Windows Mobile 5.0 except when saving the file I get the error as "WinCE501bException".

I am using fwrite / fopen for file access

Please tell me whether this is issue with windows mobile 5.0

Regards

Anwar

[479 byte] By [MAnwar] at [2007-12-23]
# 1

try these functions...

#########

Public Function ReadFile(ByVal strFileName As String) As String

Dim strFile As String

Try

Dim srFile As StreamReader = File.OpenText(strFileName)

strFile = srFile.ReadToEnd()

srFile.Close()

srFile.Dispose()

srFile = Nothing

Catch ex As Exception

strFile = ""

End Try

Return strFile

End Function

Public Function WriteFile(ByVal strFileName As String, ByVal strContent As String) As Boolean

Dim blnOK As Boolean = False

Try

Dim fs As New FileStream(strFileName, FileMode.Create, FileAccess.Write)

Dim writer As New StreamWriter(fs)

writer.Write(strContent)

writer.Flush()

fs.Flush()

fs.Close()

blnOK = True

Catch ex As Exception

blnOK = False

End Try

Return blnOK

End Function

Anarchy at 2007-8-30 > top of Msdn Tech,Smart Device Development,Smart Devices General...
# 2
Applications built with VS2005 are equally capable of running on WM2003 devices. As for the exception - I am not aware of anything that remotely sounds like "WinCE501bException" in the native code. Your application is written in C++, not C#, right?
AlexFeinman at 2007-8-30 > top of Msdn Tech,Smart Device Development,Smart Devices General...
# 3

We have the same problem with an app written in C# that is using the Disconnected Service Agent (part of the Mobile Software Factory), it happens only when the DSA is working and using a Wi-Fi connection. The DSA is using some native APIs to detect the type of connection available.

We are using it with a Dell Axim x51.

Is there anyway to correct this?

mamadero at 2007-8-30 > top of Msdn Tech,Smart Device Development,Smart Devices General...