473,785 Members | 2,299 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Translating Code from C++ to C#

Could someone please tell me, how easy or difficult , it is to transfer code
written in C++ to C#.

I wrote a program for FTP ( in C++), and need to translate that code in C#.
As a beginner of C# I'm not sure how much work is required, and I wanted to
get a feel of it before I started.

If someone could advise.

Thanks
Idris
Nov 15 '05 #1
3 1547
It depends if you use new-style declarations (like the 'new' keyword) or
old-style (like malloc()) - the new-style is quite similar to C#. The main
problem is really memory management and pointers. If your app has tons of
pointers to structures (yuck!!) then you will likely be doing a lot of
coding...

The bottom line is if you took all the pointers and memory management out of
C++ - what's leftover is VERY simlilar to C#..

"Idris Farooqi" <id***@cs.jhu.e du> wrote in message
news:IZ******** *********@nwrdd c01.gnilink.net ...
Could someone please tell me, how easy or difficult , it is to transfer code written in C++ to C#.

I wrote a program for FTP ( in C++), and need to translate that code in C#. As a beginner of C# I'm not sure how much work is required, and I wanted to get a feel of it before I started.

If someone could advise.

Thanks
Idris

Nov 15 '05 #2
It depends entirely on the C++ style. If the C++ programmer expressed the
algorithm straightforward ly, using simple data types, then it will be easy.
If it's full of C++ tricks and obscurities, it won't be.

"Idris Farooqi" <id***@cs.jhu.e du> wrote in message
news:IZ******** *********@nwrdd c01.gnilink.net ...
Could someone please tell me, how easy or difficult , it is to transfer code written in C++ to C#.

I wrote a program for FTP ( in C++), and need to translate that code in C#. As a beginner of C# I'm not sure how much work is required, and I wanted to get a feel of it before I started.

If someone could advise.

Thanks
Idris

Nov 15 '05 #3
On Sat, 23 Aug 2003 19:09:28 GMT, "Idris Farooqi" <id***@cs.jhu.e du> wrote:
Could someone please tell me, how easy or difficult , it is to transfer code
written in C++ to C#.


In addition to the other replies, which focus on the language issues, there
are the underlying platform issues.

It could be as simple as replacing socket with Socket and similar
substitutions, though I haven't looked at the two interfaces (Platform SDK
and .Net Framework) to see if there's more to it that that. And if your
C++ code is for UNIX, it could be far worse. I have no way of knowing
whether you'll come up against any serious problems in regard to this, but
even if you don't, dealing with the platform issues can be far more tedious
and error-prone than just dealing with the language issues.

Gary

Nov 15 '05 #4

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

Similar topics

6
1561
by: Davis Marques | last post by:
hi; I'm translating some PHP scripts to Python and have hit a roadblock with a for statement. If someone could explain to me how one should translate the multiple increment, evaluations, etc. in the first line I would appreciate it deeply ... for ($y = 0, $x = $cx-$cy-1; $y <= $cy; ++$y,++$x) { $prd = $q * $y_ar + $car; $prd -= ($car = intval($prd / 1E7)) * 1E7;
2
1447
by: Henrik S. Hansen | last post by:
How do you best go about translating characters like '\\n' to '\n'? This is for a configuration file parser, where the "backslash convention" is supported. The naive approach -- re.sub('\\\\(.)', '\\\1', s) -- doesn't work, of course. The best I've come up with so far is a special case for every character to be translated. There must be an easier way? -- Henrik S. Hansen http://freecode.dk/~hsh/
12
1659
by: Charles Law | last post by:
Hi guys A bit of curve ball here ... I have a document (Word) that contains a series of instructions in sections and subsections (and sub-subsections). There are 350 pages of them. I need to translate these instructions into something that can be processed automatically, so I have used the Command pattern to set up a set of commands that correspond to the various instructions in the document.
23
3156
by: gregf | last post by:
I have a paragraph of text pasted into a word document, it's in Polish, complete with polish characters. They show up just fine in word, but the program I use for web page programming, HomeSite, won't translate it. When I paste the text into the code, the special characters are missing. If they would show up there I could use the Replace Special Characters feature to change it to the proper code, but it won't even paste into it...
0
1121
by: Dylan Phillips | last post by:
I'm interested in how other participants in this new group are implementing SQL Full-Text Search on their Web Sites. How are you translating the user search string: "DirectX managed code" into the contains statement syntax ' "DirectX" AND "managed" AND "code" '? I started writing a query parsers as an intermediary to handle control characters like , but frankly it's becoming a rather pain in the a$$. If anyone has any suggestions as...
6
2533
by: Jumping Matt Flash | last post by:
The code i'm writing is using VB .NET and is for a web service returning a dataset, which is in turn to be used by an ASP .NET application displaying a datagrid. I'm currently populating a datagrid using a "select top 1 column 1, column2, column3 from tblTable" statement. As there will only ever be one row returned I want to be able to to switch the column names to be row1 and the column values to be row 2 i.e. select house, street,...
1
1867
by: timn | last post by:
Translating Access SQL queries into SQL subqueries. -------------------------------------------------------------------------------- I have a query in Access that uses a subquery, I would like some help on translating it into SQL as a subquery so I can use it in an application. the queries in Access are the subquery... (query4) SELECT Movement.DateTime, Movement.StudentID, Movement.Subject, Movement.Teacher, Movement.Destination,...
1
2095
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: Can Some body help me translating the following code from classic Vb to Vb.Net Option Explicit Private Sub Command1_Click() On Error GoTo command_error
2
3523
by: Andrus | last post by:
I have resource files in different languages created by VCS 2005 Express. I want to use those files to translate reports at runtime. I have text to be translated as string. I think I need to search resource file for this string id. After that I need to return translated string from other resouce file ? Is this best idea? Where to find sample code which implements this ?
5
4987
by: Andrus | last post by:
I have database containing translations. I'm creating VS 2005 WinForms application which should use this database to translate menu items to user language. I replaced lines in myform.designer.cs like Text = "File"; to call my translating routine
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9947
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5379
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.