473,320 Members | 1,909 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,320 software developers and data experts.

problem with calling main() function

I'm using Borland C++ ver 5.02
There's a problem when i try to call main() from within the main
It says "cannot call main from within the program"
I'm using *.c as the default extension.
Mar 5 '07 #1
3 1957
willakawill
1,646 1GB
Hi. this is not a problem. This is correct. You will have to code it differently.
Mar 5 '07 #2
Hi. this is not a problem. This is correct. You will have to code it differently.
you must be right, but then why does it not generate an error when i compile it using turbo c++ ver 3.0
Mar 5 '07 #3
DeMan
1,806 1GB
I won 't pretend to know why or how, but the easiest way around it (if you really feel you need to do it).....

declare some function with the same sort of signature:

int myMain(char* args) /* and maybe another parameter, I forget main a bit */

from within it, you can call itself, and if all your main method does is calls this then you basically have the same effect.

I suspect it's probably dangerous to treat main as a recursive function......
Mar 5 '07 #4

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

Similar topics

9
by: SB | last post by:
Ok, very simple problem. I'm trying to update a value by calling a function using pass by reference, but it does not update the value. In short, the value I'm trying to update is balance, which is...
3
by: Tony Johansson | last post by:
Hello! I have some problem with STL. I have two classes called Handle which is a template class and Integer which is not a template class. The Integer class is just a wrapper class for a...
6
by: os2 | last post by:
hi i would like to try to reduce global variable for a program... i get a value from getenv... after this value will never change... i tried this code: void readRtuConfig(char *local_dir_led)...
8
by: Michel Rouzic | last post by:
I'm sure that it's a dumb problem where i surely did something dumb, but, I got a problem, I got a variable that we'll call var1. in the main() function, this variable var1 (of type unsigned) of a...
1
by: Smita Prathyusha | last post by:
I am facing a problem in writing to COM1. I am using a Win 32 Console mode Program in VC++ the following is the code: If anyone can help me out it will be of great help : // SC_Using_Classes.cpp...
23
by: lisp9000 | last post by:
I wrote a small test program to read a file of data and print each line, but it's only printing the 2nd line out of 3 total lines. The test file, "foo.txt", has 3 lines: 7388: Zn->Z0 Run...
11
by: venkatagmail | last post by:
I have problem understanding pass by value and pass by reference and want to how how they are or appear in the memory: I had to get my basics right again. I create an array and try all possible...
47
by: mukeshrasm | last post by:
Hi I am calling two pages using Ajax Get_Pages.php and Get_Content.php from combo box. Both pages are displayed based on selection from combo box. Main problem is that it is not showing the...
6
by: Gaijinco | last post by:
I'm trying to do a template class Node. My node.hpp is: #ifndef _NODE_HPP_ #define _NODE_HPP_ namespace com { namespace mnya { namespace carlos { template <typename T>
4
by: Immortal_Nephi | last post by:
You have written several global functions inside header code. Then, you create either static library or dynamic linked library. All global functions can be reuseable to the main() function when...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.