ReadFile

Definition

Usage

Read the file with the specified name from the device. The file path is usually /mnt/mtdblock/.

Parameter

Device number

FileName

Name of the file to be read from the device

FilePath

Path of the file to be read

Return Value

Return True if it is successful, or return False.

Related Function

SendFile

 

Ejemplo

C#

private static int readFile(string ipAddr, int port, string path, string fileName)
        {
int idwErrorCode = 0;
//Create Standalone SDK class dynamicly.
            zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
if (axCZKEM1.Connect_Net(ipAddr, 4370))
            {
int iMachineNumber = 1;
if (axCZKEM1.ReadFile(iMachineNumber, fileName, path))
                {
                    MessageBox.Show("Operation Success! Read File from device: " + ipAddr);
                }
else
                {
                    axCZKEM1.GetLastError(ref idwErrorCode);
                    MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
                }
            }
else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
            }
return idwErrorCode;
        }

VB

Private Sub readFile(ipAddr As String, port As Int32, path As String, fileName As String)
'Create Standalone SDK class dynamicly.
Dim axCZKEM1 As New zkemkeeper.CZKEM
Dim iMachineNumber As Integer
Dim idwErrorCode As Integer
If axCZKEM1.Connect_Net(ipAddr, port) = True Then
Dim iDelay As Integer = 4 'time to delay
If axCZKEM1.ReadFile(iMachineNumber, fileName, path) = True Then
                MsgBox("Operation Success! Data Read from device: " + ipAddr)
Else
                axCZKEM1.GetLastError(idwErrorCode)
                MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
End If
Else
            axCZKEM1.GetLastError(idwErrorCode)
End If
End Sub