#include header

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • clinisbut

    #include header

    may be i'm asking a stupid question, but, is it possible to include a
    header file at runtime??

    I have some header files with this inside:

    {{12, 16},{
    0x00,0x00, /* ............... . */
    0x00,0x00, /* ............... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x00,0x00, /* ............... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x00,0x00, /* ............... . */
    0x00,0x00, /* ............... . */
    0x00,0x00, /* ............... . */
    0x00,0x00, /* ............... . */
    0x00,0x00 /* ............... . */
    }}

    What I'm trying to do is load this files at user interact.
    I don't know If there is a way to automatically like JSON with
    javascript...
  • Looney

    #2
    Re: #include header



    clinisbut wrote:
    may be i'm asking a stupid question, but, is it possible to include a
    header file at runtime??
    >
    I have some header files with this inside:
    >
    {{12, 16},{
    0x00,0x00, /* ............... . */
    0x00,0x00, /* ............... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x00,0x00, /* ............... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x33,0x30, /* ..%%..%%..%%... . */
    0x00,0x00, /* ............... . */
    0x00,0x00, /* ............... . */
    0x00,0x00, /* ............... . */
    0x00,0x00, /* ............... . */
    0x00,0x00 /* ............... . */
    }}
    >
    What I'm trying to do is load this files at user interact.
    I don't know If there is a way to automatically like JSON with
    javascript...
    In C/C++, code needs compilation after headers are included as they
    change the meaning of a translation unit.
    So No you can not include headers at runtime, unless u are
    implementing some sort of a code generator or compiler which accepts
    code from you and compiles it into an application, wait a minute there
    are allready applications which do that called compilers.

    Comment

    • Alexander Dong Back Kim

      #3
      Re: #include header

      On Apr 11, 8:59 pm, clinisbut <clinis...@gmai l.comwrote:
      may be i'm asking a stupid question, but, is it possible to include a
      header file at runtime??
      >
      I have some header files with this inside:
      >
      {{12, 16},{
      0x00,0x00, /* ............... . */
      0x00,0x00, /* ............... . */
      0x33,0x30, /* ..%%..%%..%%... . */
      0x33,0x30, /* ..%%..%%..%%... . */
      0x33,0x30, /* ..%%..%%..%%... . */
      0x33,0x30, /* ..%%..%%..%%... . */
      0x33,0x30, /* ..%%..%%..%%... . */
      0x33,0x30, /* ..%%..%%..%%... . */
      0x00,0x00, /* ............... . */
      0x33,0x30, /* ..%%..%%..%%... . */
      0x33,0x30, /* ..%%..%%..%%... . */
      0x00,0x00, /* ............... . */
      0x00,0x00, /* ............... . */
      0x00,0x00, /* ............... . */
      0x00,0x00, /* ............... . */
      0x00,0x00 /* ............... . */
      >
      }}
      >
      What I'm trying to do is load this files at user interact.
      I don't know If there is a way to automatically like JSON with
      javascript...
      Hi there,

      Is that the syntax based on C/C++ programming language? I can see it
      seems like a kind of array. How about using data file instead?

      I may be barking on the wrong tree :P since I can't understand what
      the array like thing for.

      Cheers,
      Alex Kim

      Comment

      • Robbie Hatley

        #4
        Re: #include header


        "clinisbut" asked:
        may be i'm asking a stupid question, but, is it possible to
        include a header file at runtime??
        >
        I have some header files with this inside:
        >
        {{12, 16},{
        0x00,0x00, /* ............... . */
        0x00,0x00, /* ............... . */
        0x33,0x30, /* ..%%..%%..%%... . */
        0x33,0x30, /* ..%%..%%..%%... . */
        0x33,0x30, /* ..%%..%%..%%... . */
        0x33,0x30, /* ..%%..%%..%%... . */
        0x33,0x30, /* ..%%..%%..%%... . */
        0x33,0x30, /* ..%%..%%..%%... . */
        0x00,0x00, /* ............... . */
        0x33,0x30, /* ..%%..%%..%%... . */
        0x33,0x30, /* ..%%..%%..%%... . */
        0x00,0x00, /* ............... . */
        0x00,0x00, /* ............... . */
        0x00,0x00, /* ............... . */
        0x00,0x00, /* ............... . */
        0x00,0x00 /* ............... . */
        }}
        >
        What I'm trying to do is load this files at user interact.
        I don't know If there is a way to automatically like JSON with
        javascript...
        You can't "#include" a file at run-time, or even at compile
        time, because "#include" is a preprocessor directive which runs
        BEFORE the compiler is invoked.

        BUT, you can "include" a file in the sense of having your program
        read and use the contents, buy just opening the file.

        For example, here are two lines from one of my programs:

        std::ifstream F1 (File1.c_str(), std::ios_base:: binary);
        std::ifstream F2 (File2.c_str(), std::ios_base:: binary);

        That opens 2 files in binary mode for read-only. (The program
        then compares their contents byte by byte to determine whether
        they are duplicates.)

        You can't alter a C++ program on-the-fly at run-time, though,
        because C++ is a compiled language; the compiled machine language
        program is fixed.

        There ARE various ways of changing program behavior at runtime,
        though. These include:

        1. Command-line switches
        2. User input, either console or GUI
        3. ini files (program reads file at runtime and alters behavior)
        4. registry entries (if MS Windows)
        5. DLL files (if your compiler supports them)

        --
        Cheers,
        Robbie Hatley
        lonewolf aatt well dott com
        www dott well dott com slant user slant lonewolf slant


        Comment

        Working...