|
dear all,
I have a code in c++. I need to convert the whole project to c. Is it possibe to convert give me the tips for conversion. I will be pleased if there are any tools available for conversion.
regards,
krushna kumar.v
|
|
|
|
|
I dont know if any tool is available for such converson.
But if the code is in C++ and uses Classes with
virtual function its really difficult to convert such
code to C .
Yeh but it can be done (c++ code can be converted to c)
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
It can be done; I just would not like to do it.
How diffecult it will be depends on what features of C++ the code uses. You may find you self needing to write C versions of the STL templates.
The original C++ just used a preprocessor to convert the C++ code to C code and then called a C compiler. Modern day compilers do not require the conversion.
You can try to see if I am wrong and there is still a modern standards compliant enviroment that uses this method. You could also try to get a copy of the original, to see how it worked (the code should be out there). But of course the original would not be compliant with the current standard.
INTP
Every thing is relative...
|
|
|
|
|
Google for CFRONT. CFRONT was the original C++ compiler which compiled C++ to C as one of its steps.
|
|
|
|
|
How can i calculate power or exponent
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Take a look at the pow(...,...) function.
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
yeh i actully didnot want to use
pow ,
but now its ok
thank u
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
x^y :
for (int i = 0; i < y; i++) {
x *= x;
}
of course, this doesn't work for float powers... you'll have to find a better algorithm on the web maybe, or use assembly.
if you have the/a solution, please share it with us !
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Yeh Assembly is the solution for my issue
thanks
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
|
Hmmm...
Waiting for it buddy.
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
toxcct wrote: for (int i = 0; i < y; i++) { x *= x;}
sorry, this is incorrect code
consider where x = 2 and y = 5 (2^5)
then with above code you would be doing this
x *= 2 (x = 2 * 2)
x *= 4 (x = 4 * 4)
x *= 16 (x = 16 * 16)
x *= 256 (x = 256 * 256)
x *= 65536 (x = 65536 * 65536)
finally ending up with 4294967296 which is obviously not the correct answer
the correct code would be
int result = 1;
int y = 5;
int x = 2;
for (; y--; ) result *= x;
which would word for any arbitrary x > 0 and y >= 0
|
|
|
|
|
|
Hi,
I am working on VC++ project. Property Sheet has a number of property pages, so I want to highlight each property page TAB on its selection. Hightlight means it may paint each page TAB portion or should show same TAB text with different color.
Would you tell me the the way, How can I do it?
Thanks in advance,
Ramesh
|
|
|
|
|
You can do that in the OnSetActive() method...
Also take a look at the GetTabControl() method of the CPropertySheet Class. It returns a reference to a particular CTabCtrl object.
CTabCtrl class has a method called CTabCtrl::HighlightItem.
BOOL HighlightItem(
int idItem,
BOOL fHighlight = TRUE
);
Hope this will be sufficient for you...
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Thanks,
I want to re-modify my question.
When we select the property sheet page tabs, then the selected page tab text should change the color of page tab text or highlight the tab text.
Error is comming from the fallowing snippet that is,
<big>Error : " 'CPropertySheet::GetTabControl' : illegal call of non-static member function"</big>
How to access the GetTabContol() from CPropertyPage derived class?
<code>BEGIN_MESSAGE_MAP(CPage2, CPropertyPage)
//{{AFX_MSG_MAP(CPage2)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CPage2::OnSetActive()
{
CTabCtrl *pTabCtrl = CPropertySheet::GetTabControl();
TC_ITEM item;
item.mask = TCIF_TEXT;
item.pszText = "New Label";
pTabCtrl->SetItem (1, &item );
// CTabCtrl::HighlightItem(1, TRUE);
return CPropertyPage::OnSetActive();
}</code>
wating for you reply,
- Ramesh.
|
|
|
|
|
I want to make an oracle db installer for my program. When it is executed it should be able to search the tnsnames.ora and list the services in combo box. Up to this it is finished(got the idea from http://www.codeproject.com/database/OSidList.asp)
Now, I want to:
1. logging to the service with login id and password :
2. after successful login all the users under the service should be listed. I can either choose the existing user or create a new user with sufficient rolls.
3. after that I want to execute scripts for creating tables etc. These scripts are stored in separate folder.
How will I write functions which perform the above tasks?
|
|
|
|
|
Hi all:
I'm under VC++ 7.0, and new to it. Regarding the following code
CFile file;
if ( ! file.Open(LPCTSTR ("C:\\Test.xml"), CFile::modeRead ) )
{
return;
}
After open operation why the file alway invalid?I don't see any problem!
|
|
|
|
|
LiYS wrote: if ( ! file.Open(LPCTSTR ("C:\\Test.xml"), CFile::modeRead ) )
Is Test.xml is exist at C:, as CFile::ModeRead will get failed if file requested isn't found.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote: Is Test.xml is exist at C:,
That was confirmed!
|
|
|
|
|
LiYS wrote: That was confirmed!
I am lil Confused! what was confirmed?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
to complete alok's answer, don't use the cast operator to LPCTSTR this way.
change the LPCTSTR(...) into (LPCTSTR)... .
refer this[^] to understand...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 4:42 Tuesday 27th December, 2005
|
|
|
|
|
toxcct wrote: change the LPCTSTR(...) into (LPCTSTR)....
I'll try that, thanks!
But here's another Que I encountered!
I can't use GetCurrentDirectory(...), I always get compiler error saying "identifier not found". Is it because of the project I started.
I started the project as VC++/SmartDevice
|
|
|
|
|
toxcct wrote: change the LPCTSTR(...) into (LPCTSTR)....
if ( ! file.Open( (LPCTSTR)"C:\\Test.xml", CFile::modeRead ) )
doesn't works either!
|
|
|
|
|
try
if ( ! file.Open( _T("C:\\Test.xml"), CFile::modeRead ) )
<hr<span style="color:gray;size:15px;">Prakash
Prakash
|
|
|
|