Query: Display Line Number infront of each Line of source (MFC)
-
Hi, I want to open & display a file(ex: .C) with Line Number to be displayed infront of each line. (Ex: Like C Debugger have) Plz. send me code if anybody written... irshad_b@indiatimes.com Thanks in Advance, Regards, Irshad
-
Hi, I want to open & display a file(ex: .C) with Line Number to be displayed infront of each line. (Ex: Like C Debugger have) Plz. send me code if anybody written... irshad_b@indiatimes.com Thanks in Advance, Regards, Irshad
I know how to do it, but i am not going to write a code for you.but hey how lazy can you get?
P.R.A.K.A.S.H
-
Hi, I want to open & display a file(ex: .C) with Line Number to be displayed infront of each line. (Ex: Like C Debugger have) Plz. send me code if anybody written... irshad_b@indiatimes.com Thanks in Advance, Regards, Irshad
Assuming you have an edit control with the
ES_MULTILINE
style, you can do something like:CStdioFile file(_T("c:\\boot.ini"), CFile::modeRead);
CString strFileLine,
strEditLine;
int nLine = 1;while (file.ReadString(strFileLine) != FALSE)
{
strEditLine.Format(_T("%d %s\r\n"), nLine++, (LPCTSTR) strFileLine);
m_edit.ReplaceSel(strEditLine);
}
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
-
Assuming you have an edit control with the
ES_MULTILINE
style, you can do something like:CStdioFile file(_T("c:\\boot.ini"), CFile::modeRead);
CString strFileLine,
strEditLine;
int nLine = 1;while (file.ReadString(strFileLine) != FALSE)
{
strEditLine.Format(_T("%d %s\r\n"), nLine++, (LPCTSTR) strFileLine);
m_edit.ReplaceSel(strEditLine);
}
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
Thanks for ur reply.. Sorry i am asking silly questions..as I am new to MFC...Actually i want to 1. open C source file with standard coloring of keywords of C langauge ..& 2. a new view window which display line number & have capabilty to set break-points ..(like M VC++ editor have) 3. a shared vertical scroll-bar between these windows. I am using RichEditView class for other operations like get line number on double-clk,etc.. Regards Irshad