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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Using Binary Data Directly in CPP Source Files

Using Binary Data Directly in CPP Source Files

Scheduled Pinned Locked Moved C / C++ / MFC
c++discussioncssasp-netquestion
3 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.
  • J Offline
    J Offline
    JSadleir
    wrote on last edited by
    #1

    Hi Coders If you have lots of data that you reference in an application (eg thousands of widget codes, prices and corresponding .bmp files), I gather it's possible to serialise/encode/write that data from ASCII into a binary file so that the data takes up much less space and can be accessed much more quickly by your application than if it is left in ASCII. Assuming you (1) do not want the actual data to be changed or added to after compilation by end users, but (2) you want your application to be able to quickly and efficiently reference individual items in the binary file, what do you think is the best way to include the binary file in a native Visual C++ Project? Is it possible to embed the binary file in the native Visual C++ project so that it in the application's core exe/dll without a separate external bin file? Could I do this with a cpp, lib or resource item that contains all the binary data? Any thoughts or suggestions would be much appreciated. Regards Jeremy

    S 1 Reply Last reply
    0
    • J JSadleir

      Hi Coders If you have lots of data that you reference in an application (eg thousands of widget codes, prices and corresponding .bmp files), I gather it's possible to serialise/encode/write that data from ASCII into a binary file so that the data takes up much less space and can be accessed much more quickly by your application than if it is left in ASCII. Assuming you (1) do not want the actual data to be changed or added to after compilation by end users, but (2) you want your application to be able to quickly and efficiently reference individual items in the binary file, what do you think is the best way to include the binary file in a native Visual C++ Project? Is it possible to embed the binary file in the native Visual C++ project so that it in the application's core exe/dll without a separate external bin file? Could I do this with a cpp, lib or resource item that contains all the binary data? Any thoughts or suggestions would be much appreciated. Regards Jeremy

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      JSadleir wrote:

      what do you think is the best way to include the binary file in a native Visual C++ Project?

      Add the binary data to the project as a resource then use the FindResource(Ex), LoadResource, LockResource and SizeofResource APIs to access the data. Steve

      J 1 Reply Last reply
      0
      • S Stephen Hewitt

        JSadleir wrote:

        what do you think is the best way to include the binary file in a native Visual C++ Project?

        Add the binary data to the project as a resource then use the FindResource(Ex), LoadResource, LockResource and SizeofResource APIs to access the data. Steve

        J Offline
        J Offline
        JSadleir
        wrote on last edited by
        #3

        Thanks Steve - I'll give it a go - Regards Jeremy

        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