tool for converting c cyntax to c++ syntax

is ther any tool available to convert c syntax into c++ syntax
Last edited on
C syntax is the same as C++ syntax
its not completely the same , for example librabries are different and console output statements are different..
what i need to know is , if i input c syntax i should get get corresponding c++ synatx as output
is ther any tool available as such... coz i am thinking of a new project of this sort..
Bazzy is correct. By and large, C syntax is the same as C++ syntax.

You can produce C libraries with C++.

Your project seems to be about replacing C libraries with C++ libraries within an application, not about replacing syntax.
i think u guys didn understand the whole picture..
suppose u have got a c++ prog with 10thousand lines..
and u need to add an extra functionality to the prog, and the same functionality is already done in c, and that is about thosand lines , so if u have a tool as i told , u can convert the c prog and make it completely adapt with the c++ prog
and this is the tool am talkin about
is ther any concept of this sort
so whats the problem, copy that function from C library and paste it to your C++ program and use it. it wont give any error.

but you have to check the dependencies of that function. it might be calling other functions, using global data, preprocessor directives. .. etc..
If you have the 'extra functionality' compiled in C, you may have to say extern "C" in the header files you include to have it working. If you have the 'extra functionality' sourcecode you can compile it in C++ as it is mostly compatible with C
okey.. i was thinking is to develop a program which takes c syntax as input in a file and parse the same c syntax and producing the corresponding c++ synatx in another file
how does it sound?
Can you give as an example of input and output that your program should give?

input

1
2
3
4
5
6
   
#include<stdio.h>
main()  
{
printf("hello world\n");
}


output

1
2
3
4
5
#include<iostream>
main()
{
cout<<"hello world\n";
}
This is a non-issue - both versions above are perfectly valid C++

Why don't you write a program that generates non-issues for C++ forums?

you can easily replace stdio.h iostream by parsing a bit the input.
(in C++ main should be of type int )
in this example is not so difficult transforming line 5 but it would be harder if you had some variables to output
mr bazzy, i guess u got the point, the above was jus an example, i was talkin about converting any program written in C
have u ever heard of any thing related to this..
Try to see if you find anything useful with Google
http://www.google.com/search?q=%22C+to+C%2B%2B%22+translation
Topic archived. No new replies allowed.