473,486 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Calling Hidden Function

8 New Member
Say i have 3 functions

void foo(int x);
void print(void);
int main(void);


main calls print, and print printfs out some information getting user input before exiting back to main.

However foo is not called in main, but needs to be called outside the program without it being modified, how can I go about doing this

foo does a printf when x = 3 and exits(0);

I was reading online and found something about using #pragma but I dont know it I can go forth with it.

Only languages I know are C, assembly and a little Java. Can you please give me suggestions on how to go about this problem.

I will PM you the source it you need more clarification. Thanks in advance. :)
Mar 6 '07 #1
4 1683
DeMan
1,806 Top Contributor
I'm not too surwe how #pragma works, there is plenty of resource for it on the net, but it don't make much sense to me......

If you want to make a metho globally visible, however, you can declare its' prototype/signature (that is the top line of the method followed by a semicolon) in a header file (.h) file.
Mar 6 '07 #2
WarcraftNoob
8 New Member
Ok I made some progress and I found that I have to do something along the lines of this

http://community.corest.com/~juliano...t_tutorial.txt

Example above, has

void lame (void) { char small[30]; gets (small); printf("%s\n", small); }
main() { lame (); return 0; }


but mine is
void foo(int x){ if (x==0x2345} printf("what"); exit(0);}
void lame (void) { char small[30]; gets (small); printf("%s\n", small); }
main() { lame (); return 0; }

I need to get to execute the foo function, I followed the above tutorial but im stuck at Step 3b. Somebody please clarify this with me thanks
Mar 7 '07 #3
DeMan
1,806 Top Contributor
Expand|Select|Wrap|Line Numbers
  1. main() { 
  2.    lame ();
  3.    foo(0x2345);  //or any other value if you don't want to see the what
  4.   return 0;
  5. }
  6.  
Mar 7 '07 #4
WarcraftNoob
8 New Member
Expand|Select|Wrap|Line Numbers
  1. main() { 
  2.    lame ();
  3.    foo(0x2345);  //or any other value if you don't want to see the what
  4.   return 0;
  5. }
  6.  

i cannot touch the original source, i have to do it from outside the program
Mar 7 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
7483
by: R.G. Vervoort | last post by:
I am using a javafunction (onclick in select) in which i am calling a function in php (thats why i send this to both php and javascript newsgroups). in the onclick i call the function...
6
15874
by: Richard Trahan | last post by:
I want a js function to call a Perl script residing on a server. The Perl script will return a string, to be used by the js. Pseudo code: <script> stringvar = perlfunc_on_server(stringarg)...
4
1720
by: Gibby Koldenhof | last post by:
Hiya, I'm setting up some code in the spirit of Design Patterns, OOP, etc. All nice and well, it handles pretty much all OO style things and serves my purposes well. There's one last final...
2
2186
by: Harold | last post by:
I have page A with form field and a button and when button is clicked it opens page B in another window. Page B has a treeview control and that is all. When something is selected I want the page...
0
2369
by: teddysnips | last post by:
I have Search form that allows users to retrieve records into a DataGrid. There are two search criteria - a Month and a Year, which are selected from drop-down lists. There is a server-side...
0
1821
by: teddysnips | last post by:
I have Search form that allows users to retrieve records into a DataGrid. There are two search criteria - a Month and a Year, which are selected from drop-down lists. There is a server-side...
10
6923
by: SQACPP | last post by:
Hi, I try to figure out how to use Callback procedure in a C++ form project The following code *work* perfectly on a console project #include "Windows.h" BOOL CALLBACK...
10
3232
by: sulekhasweety | last post by:
Hi, the following is the definition for calling convention ,which I have seen in a text book, can anyone give a more detailed explanation in terms of ANSI - C "the requirements that a...
4
3561
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
0
7175
jinu1996
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...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7319
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5430
agi2029
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,...
0
4559
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...
0
3069
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...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
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 ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.