Hi,
Is it possible to do something like this:
unsigned char arr[] = {
#include "cFile.c"
}
I need that C source file cFile.c to compile and its binary output to
include in array.
How we can achieve it? Any other trick to do this?
Thanks,
Sachin 13 2250
sachin wrote:
Hi,
Is it possible to do something like this:
unsigned char arr[] = {
#include "cFile.c"
}
I need that C source file cFile.c to compile and its binary output to
include in array.
How we can achieve it? Any other trick to do this?
You can compile cFile.c and copy it's bytes, (as hexadecimal, decimal or
octal text. All binary editors can show this for you), to your array
declaration.
Alternatively there might be compiler specific extensions for this,
though I doubt it. You might also consider the possibility of loading
the binary file at runtime with fread.
In article <b6************ *************** *******@u12g200 0prd.googlegrou ps.com>,
sachin <sb******@redif fmail.comwrote:
>I need that C source file cFile.c to compile and its binary output to include in array.
What do you expect to be able to do with it?
-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963) ri*****@cogsci. ed.ac.uk (Richard Tobin) writes:
In article <b6************ *************** *******@u12g200 0prd.googlegrou ps.com>,
sachin <sb******@redif fmail.comwrote:
>>I need that C source file cFile.c to compile and its binary output to include in array.
What do you expect to be able to do with it?
-- Richard
I would expect he has something which produces code based on dynamic
variables and wants to have variable records e.g accept user tweaks,
regenerate record structures, recompile record handling SW, run record
handling SW.
In article <g2**********@r egistered.motza rella.org>,
Richard <rg****@gmail.c omwrote:
>>>I need that C source file cFile.c to compile and its binary output to include in array.
>What do you expect to be able to do with it?
>I would expect he has something which produces code based on dynamic variables and wants to have variable records e.g accept user tweaks, regenerate record structures, recompile record handling SW, run record handling SW.
Possibly, but unless he tells us we can't give him much help. For
most uses he'd be wisest to to use system-dependent functions that
(for example) access the symbol table, and reading the compiled file
into an array may well not be the right way to do that.
-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)
On Jun 5, 5:25 pm, rich...@cogsci. ed.ac.uk (Richard Tobin) wrote:
In article <g28kua$ba...@r egistered.motza rella.org>,
Richard <rgr...@gmail.c omwrote:
>>I need that C source file cFile.c to compile and its binary output to include in array.
What do you expect to be able to do with it?
I would expect he has something which produces code based on dynamic
variables and wants to have variable records e.g accept user tweaks,
regenerate record structures, recompile record handling SW, run record
handling SW.
Possibly, but unless he tells us we can't give him much help. For
most uses he'd be wisest to to use system-dependent functions that
(for example) access the symbol table, and reading the compiled file
into an array may well not be the right way to do that.
-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)
Hi,
I have one C source file which after compiling I need to copy at
specific location.
Until system comes up I don't have access to that memory location. So
I want to keep
that code in executable form with the OS image. When system comes up
will copy that
executable code to designated space.
Thanks,
Sachin
In article <g2***********@ pc-news.cogsci.ed. ac.uk>,
Richard Tobin <ri*****@cogsci .ed.ac.ukwrote:
>In article <b6************ *************** *******@u12g200 0prd.googlegrou ps.com>, sachin <sb******@redif fmail.comwrote:
>>I need that C source file cFile.c to compile and its binary output to include in array.
What do you expect to be able to do with it?
Why, to smash the stack, of course.
It's perfectly obvious that all of these queries about needing to
include (seemingly) random sequences of bytes in code are about
"cracking/hacking/freeking/whatever-you-want-to-call-it" - let's not get
into that argument...
Not necessarily for evil purposes, mind you. It's worth the exercise
just to learn what all the fuss is about.
sachin <sb******@redif fmail.comwrote:
On Jun 5, 5:25 pm, rich...@cogsci. ed.ac.uk (Richard Tobin) wrote:
In article <g28kua$ba...@r egistered.motza rella.org>,
Richard <rgr...@gmail.c omwrote:
>>>I need that C source file cFile.c to compile and its binary output to
>>>include in array.
>What do you expect to be able to do with it?
>I would expect he has something which produces code based on dynamic
>variables and wants to have variable records e.g accept user tweaks,
>regenerate record structures, recompile record handling SW, run record
>handling SW.
Possibly, but unless he tells us we can't give him much help. For
most uses he'd be wisest to to use system-dependent functions that
(for example) access the symbol table, and reading the compiled file
into an array may well not be the right way to do that.
I have one C source file which after compiling I need to copy at
specific location.
Until system comes up I don't have access to that memory location. So
I want to keep
that code in executable form with the OS image. When system comes up
will copy that
executable code to designated space.
You can't simply include a binary file (the C source will be
of no use anyway). Just write a little utility that opens the
file you want to insert as data at that place, reads the data
from the file in as unsigned chars and writes them out in a
form like this:
unsigned char array[ ] = {
0x01, 0x3A, 0xA6, 0x12, 0x17, 0xC3, 0x7D, 0x5F,
.....
};
Save that to a file (e.g. data.h). Then include the data.h
file at exactly the place where you want the array to be
defined. Lets hope that the binary file isn't too long to
be stored in an array.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\______________ ____________ http://toerring.de
On 5 Jun 2008 at 12:44, sachin wrote:
I have one C source file which after compiling I need to copy at
specific location.
If you're writing a virus, the man's way is to write the shellcode by
hand in assembly, not use a compiled C file.
Antoninus Twink wrote, On 05/06/08 17:18:
On 5 Jun 2008 at 12:44, sachin wrote:
>I have one C source file which after compiling I need to copy at specific location.
If you're writing a virus, the man's way is to write the shellcode by
hand in assembly, not use a compiled C file.
On one DSP I used to use there was a perfectly good and "standard"
reason for wanting to achieve what the OP wants to achieve. However, the
implementation provided special tricks in the linker to allow you to
achieve it which did not involved doing what the OP asked about.
The OP needs to ask about the real problem rather than what he thinks
the solution is in a group dedicated to his implementation.
--
Flash Gordon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: LutherRevisited |
last post by:
This may be a dumb question, but are there any practical advantages of
compiling a python application to *.pyo, or *.pyc? I haven't noticed any
difference in the performance of text *.py or a bytecompiled file.
|
by: G.H.Lawrence |
last post by:
Hello. I am relatively new to VS.NET and have ingerited a web application built by 2 previous developers. The most recent one compiled his C# source to a dll, the first one left her C# source as aspx.cs files. I have to debug and enhance the appliation but am running into a couple of issues
1. in order to analyze the C# code, I must decompile the existing dll someho
2. I have a source tree from the last developer but he wasn't a diligent...
|
by: Craig |
last post by:
Is there a way to conditionally include a file in the HTML?
<TD>
if x= 1 then
<!--#INCLUDE FILE="../File1"-->
else
<!--#INCLUDE FILE="../File2"-->
end if
|
by: Al-Burak |
last post by:
I have a class which only purpose is to provide services to a variety
of classes in other files. The 'manipulator' class is aware of the
other classes only because the header files have been include in its
header file. However, there are times when some of the other classes
are not and will not be dealt with, thus the need to include the header
files does not arrive. To handle this, I have used compiler
preprocessors to prevent the...
|
by: david.lindsay.green |
last post by:
Hello all, I am quite new a web scripting and making web pages in
general and I have stumbled across a problem I have as yet been unable
to solve. I am trying to take the contents of a textarea box and save
it to a file. This step is not to hard however the contents of the
textarea is mostly latex source so it contains just about every special
character you can imagine. My question is this, how do I save an exact
copy of the textarea...
| |
by: Marcelo Gosling |
last post by:
Hi, everyone.
This is on WinXP SP2, with Python 2.4.3 and DJGPP gcc 4.1.0.
I'm having trouble including Python.h in a C file. The following C
code:
#include "Python.h"
int main()
|
by: Marc Jeambrun |
last post by:
Hello,
I have a simple question I would like to ask to you guys... It boils
down to a simple observation about all the C libraries existing out
there: there must be a C source file that must be compiled first, I mean
before all the others.
That's why I poke my nose in a C library (GNU glibc for instance) to
find out this mysterious file... This is indeed the library programmers
(including me) often refer to.
|
by: cooltoriz |
last post by:
Hello there,
I just found that the compiled code won't hide the string variables so
that I can see them by opening the execuable using Notepad. I have
couple applications that have password hardcoded and I've been thinking
that the string varialbes are hidden in compiled code. I knew that the
VS.NET doesn't compile the source code into machine code. But I didn't
know that it will expose string variables in the compiled code. Here is
my...
|
by: Robert Cloud |
last post by:
Is it possible to include assembly language routines in
C if I'm using a compiler which has an assembler such as gcc? could I
include them in a main function or would I have to write a seperate
function? what kind of privilege level would be required to execute
a program with assembly in it? how would I denote that the following
code is assembly and thus shouldn't be checked for syntax errors?
------------------------------
Robert Cloud...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |