Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Query: Display Line Number infront of each Line of source (MFC)

Query: Display Line Number infront of each Line of source (MFC)

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasecomdebugging
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    irshad_bukhari
    wrote on last edited by
    #1

    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

    P D 2 Replies Last reply
    0
    • I irshad_bukhari

      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

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • I irshad_bukhari

        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

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        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)

        I 1 Reply Last reply
        0
        • D David Crow

          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)

          I Offline
          I Offline
          irshad_bukhari
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups