hi
i have this function:
Public Function GetFile(Filename As String)

Dim path As String
Dim Fnum As Integer

'---read file in one pass!
Fnum = FreeFile
Open Filename For Input As #Fnum
GetFile = Input(LOF(Fnum), Fnum)
Close Fnum

Exit Function

ErrorHandler:
Err.Description = "GetFile: " & Err.Description & " -> " & File
Err.Raise Err.Number


End Function

AND

Private Sub Form_Load()
Dim path As String

On Error GoTo nofile

If Command$ Empty Then
Form1.Print
Form1.Print
Form1.Print
Form1.Print

Form1.Print "Command Line Parameter passed: " + Command$
If Left$(Command$, 1) = Chr$(34) And Right$(Command$, 1) = Chr$(34) Then
path = Mid(Command$, 2, (Len(Command$) - 2))
Else
path = Command$
End If
'MsgBox (path)
Form1.Print "Path of File passed: " + path
Form1.Print
Form1.Print "File contents: " + vbCrLf

Form1.Print GetFile(path)

Else
'MsgBox ("No Parameters passed!")
End If

Exit Sub 
nofile:
MsgBox ("ERROR: No valid text file!")

End Sub

but as u can see..they are written in VB
i need the same thing but in Vc++/MFC
so, is there any equivalent functions for them
if not....could someone pleeease help me with this
reeealy ..any kind of help would be appriciated
thank u in advance

With MFC you could lookup how to use class CStdioFile (see the Read() and GetLength() member functions).

thank u for ur fast reply
i tried the CFile class open and read
but it didnot work because it had something to do with my file...so can u help me with this ???bear with me pleease.
and how can i set the text to my edit control... i tried setwindowtext () but i had an error saying :
error C2039: 'SetWindowTextA' : is not a member of 'CString'
again ....thank u

Basically you can read a file like

CStdioFile File;
File.Open("c:\\file.txt", CFile::modeRead|CFile::typeBinary);
DWORD size = File.GetLength();
BYTE * p = new BYTE[1+size];
if(p)
{
    File.Read(p, size);  // Read should return the value of 'size'
    p[size] = 0;		
}

SetWindowText() is a member of CWnd, so if you have pointer (CWnd *) to your window, call it like

CString str = "Text";
pWnd->SetWindowText(str);
This article has been dead for over six months. Start a new discussion instead.