Reading binary files in C

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saranjegan
    New Member
    • Feb 2007
    • 50

    #1

    Reading binary files in C

    hi dudes,

    am in need to read and display a binary file..
    shall i fallow this procedure
    open the file using fopen and read the datas using fread but how can i display the file is it possible ?

    let the environment be Visual C++
    binary file be an image (bmp)

    am in need of the procedural steps
    let me try..thanks for your time
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    Originally posted by saranjegan
    hi dudes,

    am in need to read and display a binary file..
    shall i fallow this procedure
    open the file using fopen and read the datas using fread but how can i display the file is it possible ?

    let the environment be Visual C++
    binary file be an image (bmp)

    am in need of the procedural steps
    let me try..thanks for your time
    when you read the BMP image you can check the format is correct by printning inormation in the header etc
    http://www.fortunecity .com/skyscraper/windows/364/bmpffrmt.html

    or you could display usinga suitable library function

    Comment

    • saranjegan
      New Member
      • Feb 2007
      • 50

      #3
      Originally posted by horace1
      when you read the BMP image you can check the format is correct by printning inormation in the header etc
      http://www.fortunecity .com/skyscraper/windows/364/bmpffrmt.html

      or you could display usinga suitable library function

      thanks for your link it helps me in reading the both file header and bitmap info header and printed the values too..it works out correctly but how can i display the image now

      Comment

      • horace1
        Recognized Expert Top Contributor
        • Nov 2006
        • 1510

        #4
        Originally posted by saranjegan
        thanks for your link it helps me in reading the both file header and bitmap info header and printed the values too..it works out correctly but how can i display the image now
        what compiler/operating system are you using? have a look thru the help system to see if there is a suitable library function

        Comment

        • saranjegan
          New Member
          • Feb 2007
          • 50

          #5
          Originally posted by horace1
          what compiler/operating system are you using? have a look thru the help system to see if there is a suitable library function

          am using Visual C++ in Windows OS

          i will try through help..let me know the functions if you know it...thanks for your time

          Comment

          • horace1
            Recognized Expert Top Contributor
            • Nov 2006
            • 1510

            #6
            Originally posted by saranjegan
            am using Visual C++ in Windows OS

            i will try through help..let me know the functions if you know it...thanks for your time
            I don't use VC but I think you would use the LoadImage API
            http://support.microso ft.com/kb/q158898/

            Comment

            • saranjegan
              New Member
              • Feb 2007
              • 50

              #7
              Originally posted by horace1
              I don't use VC but I think you would use the LoadImage API
              http://support.microso ft.com/kb/q158898/
              oh thanks dude..i finished displaying..you r guidance helped a lot..thanks for your time will catch u soon with some other problems...

              Comment

              Working...