473,382 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

#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...
Apr 11 '08 #1
3 2006


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.

Apr 11 '08 #2
On Apr 11, 8:59 pm, clinisbut <clinis...@gmail.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
Apr 11 '08 #3

"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
Apr 11 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Ramesh | last post by:
Hi, I am currently maintaining a legacy code with a very very large code base. I am facing problems with C/C++ files having a lot of un-necessary #includes. On an average every C/C++ file has...
18
by: Exits Funnel | last post by:
Hello, I'm a little confused about where I should include header files and was wondering whether there was some convention. Imagine I've written a class foo and put the definition in foo.h and...
11
by: wenmang | last post by:
Hi, all: What will happen if header files with the exact same names but with different contents and declared/defined without include guard reside in the include path for the compiler? Are these...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
9
by: bill | last post by:
Forget the exact definition of difference between, #include <foo.h> and #include "bar.h" Normally foo.h is a standard header file, so it's path is not defined in compiler option, but I...
12
by: Francois Grieu | last post by:
Can #include safely use a preprocessing token, as in #define HEADERFILE "stdio.h" #include HEADERFILE int main(void) {return printf("Hello, world\n")*0;} TIA, François Grieu
14
by: Jon Rea | last post by:
I am currently cleaning up an application which was origainlly hashed together with speed of coding in mind and therefore contains quite a few "hacky" shortcuts. As part of this "revamping"...
9
by: chat | last post by:
Hi, every body. I have 3 files like this: -------------------------------------------------------- file name : header.h #ifndef TEST_H #define TEST_H int a=1; double b=0.5;
8
by: The Cool Giraffe | last post by:
One thing i do know for sure. When one creates a CPP file, one needs to include the H file. Now, having said that, i wonder if there are some general hints, requirements or standard guide lines on...
25
by: Mark | last post by:
so, i'm making a website. let's say i have header.php, footer.php and content.php. now in index.php I simply want to include the 3 pages. easy enough to do. but let's say the user navigates to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.