473,398 Members | 2,188 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,398 software developers and data experts.

Converting a C program to C#

I have a program written in C which I need to convert it to C#. This program
includes about six header files and it makes calls to functions which havee
been defined in other C programs . How can I convert only this program to C#
without bothering about other C programs used by this program? Do I need to
just add the include files in the project? What's the best way to develop
this?

Any feedback will be greatly appreaicted.

Thanks,
Gilgamesh
Jan 15 '07 #1
4 2017

Perhaps start from scratch.? (realistic.)

You whould have to atleast list the program that you are trying to convert.
We havent a clue as to the scope of your program.

I have to warn you, c code and managed c# code can be completely different
beasts.

As for the rest of your classes, if they are in a dll, you most likely could
reuse them.

If your code works just fine, why convert?

"Gilgamesh" wrote:
I have a program written in C which I need to convert it to C#. This program
includes about six header files and it makes calls to functions which havee
been defined in other C programs . How can I convert only this program to C#
without bothering about other C programs used by this program? Do I need to
just add the include files in the project? What's the best way to develop
this?

Any feedback will be greatly appreaicted.

Thanks,
Gilgamesh
Jan 15 '07 #2
Not sure about C#, but you can always compile this project with added CLR
support.

Right-click on project =Properties =Common Language Runtime support =>
Select CLR support in the combo box =Apply.

I can guarantee it will not compile at once. You will need to change other
project's settings. Read MSDN (Common Language Runtime Compilation), which
will explain a bit.

Once this compiles successfully, you can define managed C++ classes in it.
This will turn the project into a .Net class library assembly. Then you can
add references to this assembly in other projects, C# or Vb.Net.
"Gilgamesh" <gi************@aol.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>I have a program written in C which I need to convert it to C#. This
program includes about six header files and it makes calls to functions
which havee been defined in other C programs . How can I convert only this
program to C# without bothering about other C programs used by this
program? Do I need to just add the include files in the project? What's the
best way to develop this?

Any feedback will be greatly appreaicted.

Thanks,
Gilgamesh

Jan 16 '07 #3
"Gilgamesh" <gi************@aol.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>I have a program written in C which I need to convert it to C#.
Why? Has it stopped working...?
This program includes about six header files
*About* six...? Is that five, six, seven...? Do you not actually know how
many headers are included...? You will need to get a complete picture of
what the C program is doing before you can proceed with this...
and it makes calls to functions which have been defined in other C
programs.
And what are they...?
How can I convert only this program to C#
Impossible to advise you with the level of information you've provided so
far...
Jan 16 '07 #4
Despite similar syntax, C and C# are radically different languages. C uses
pointers extensively but C# does not (instead, pointer-like things are done
for you by the object-oriented type system). Unless the conversion is
necessary for some reason, I would recommend not doing it.

Jan 16 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dan Stromberg | last post by:
I've written up a page about how to convert native binary data to another platform's native binary data, as I did some fortran data conversions for a client. The programs and documentation are...
4
by: Joseph Suprenant | last post by:
I have an array of unsigned chars and i would like them converted to an array of ints. What is the best way to do this? Using RedHat 7.3 on an Intel Pentium 4 machine. Having trouble here, hope...
20
by: Al Moritz | last post by:
Hi all, I was always told that the conversion of Word files to HTML as done by Word itself sucks - you get a lot of unnecessary code that can influence the design on web browsers other than...
4
by: Cyde Weys | last post by:
I'm currently working on converting a simulator program from Visual Basic 6.0 to Visual C++ .NET. I've figured out most of the stuff, but there's still one thing I haven't gotten to and I've never...
4
by: Clark Stevens | last post by:
I have a program that I'm converting from VB6 to VB.NET. It reads in a text file containing barcode numbers and their corresponding descriptions. Then the user enters the barcode number and the...
30
by: zexpe | last post by:
I have an extremely cpu/data intensive piece of code that makes heavy use of the following function: void convertToDouble(const std::string& in, double& out) { out = atof(in.c_str()); } I...
5
by: Testguy | last post by:
Hi, I was wondering if one the smart people that frequent this group could give me a hand with a small program I am attempting to debug. I am not a highly experienced developer, but can...
10
by: Ron | last post by:
I want to calculate the surface area of a sphere from an inputed radius with option strict on. I guess I am not converting something correctly. Here is what I am doing: I have a textbox...
2
by: CoreyWhite | last post by:
Problem: You have numbers in string format, but you need to convert them to a numeric type, such as an int or float. Solution: You can do this with the standard library functions. The...
28
by: Randy Reimers | last post by:
(Hope I'm posting this correctly, otherwise - sorry!, don't know what else to do) I wrote a set of programs "many" years ago, running in a type of basic, called "Thoroughbred Basic", a type of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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
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
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
isladogs
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...

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.