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. Help!!! What does this program do?

Help!!! What does this program do?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
4 Posts 2 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.
  • U Offline
    U Offline
    User 1990498
    wrote on last edited by
    #1

    Hi, can anyone explain what does the program below do in MFC C++. void CMediVisionView::OnFileSaveasraw() { // TODO: Add your command handler code here// FILE *raw; int n; unsigned short sdata; static char BASED_CODE szFilter[] = "DICOM Files (*.txt)|*.txt|All Files(*.*)|*.*||"; CFileDialog dlg_save_as(FALSE, "dcm", NULL, OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY, szFilter); if(dlg_save_as.DoModal() == IDOK) { raw = fopen("test.raw","a+b"); for (n=0; n

    C 1 Reply Last reply
    0
    • U User 1990498

      Hi, can anyone explain what does the program below do in MFC C++. void CMediVisionView::OnFileSaveasraw() { // TODO: Add your command handler code here// FILE *raw; int n; unsigned short sdata; static char BASED_CODE szFilter[] = "DICOM Files (*.txt)|*.txt|All Files(*.*)|*.*||"; CFileDialog dlg_save_as(FALSE, "dcm", NULL, OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY, szFilter); if(dlg_save_as.DoModal() == IDOK) { raw = fopen("test.raw","a+b"); for (n=0; n

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      It shows that the person who wrote it doesn't know C++, but knows C. It's very poorly written code to open a file dialog, and open a DICOM file which has been saved as a .txt file ( this is ridiculous ), and then it opens the file, and it scales every value by taking a new theoretical maximum value, and it assumes the old maximum was 256. According to this, a RAW file is not 10 bit at all, it's just 8 bit, one byte per pixel. Christian Graus - Microsoft MVP - C++

      U 1 Reply Last reply
      0
      • C Christian Graus

        It shows that the person who wrote it doesn't know C++, but knows C. It's very poorly written code to open a file dialog, and open a DICOM file which has been saved as a .txt file ( this is ridiculous ), and then it opens the file, and it scales every value by taking a new theoretical maximum value, and it assumes the old maximum was 256. According to this, a RAW file is not 10 bit at all, it's just 8 bit, one byte per pixel. Christian Graus - Microsoft MVP - C++

        U Offline
        U Offline
        User 1990498
        wrote on last edited by
        #3

        Can you advice on a better way to write this program?thks.

        C 1 Reply Last reply
        0
        • U User 1990498

          Can you advice on a better way to write this program?thks.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          1. Don't put all variable declarations at the top of the function. C requires it, C++ does not, and it's ugly 2. ALWAYS give any variable you create a default value, when you create it. 3. Don't use crappy C FILE handles, use iostreams 4. Don't use a file extension with a known value and use it to store something totally different. 5. Don't integrate code into your code base if you have no idea what it does. Christian Graus - Microsoft MVP - C++

          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