473,468 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Converting from C++ to C#

I am converting a C++ application to C#, What in C# replaces the following
C++ functions:
overloaded opertaor=

_ecvt(Math.Abs(val),14,&dec,&sign) ; //this function converts a double to a
string & puts the position of the decimal point & the sign of value in the
dec & sign paramaters, and it lets you specify how many digits you want to
store in the string(14)

I noticed that the C# math library only has an abs() method not a fabs()
method, what would replace the fabs method?

What is used in C# to replace sprintf?

Thanks
Nov 16 '05 #1
3 9978

"rgarf" <rg***@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
I am converting a C++ application to C#, What in C# replaces the following
C++ functions:
overloaded opertaor=

Nothing, C# doesn't allow overriding the assignment operator.
_ecvt(Math.Abs(val),14,&dec,&sign) ; //this function converts a double to
a
string & puts the position of the decimal point & the sign of value in the
dec & sign paramaters, and it lets you specify how many digits you want to
store in the string(14)

I don't understand waht you are asking here.
I noticed that the C# math library only has an abs() method not a fabs()
method, what would replace the fabs method?

Math.Abs deals with integers and floating point numbers, does fabs offer
anything else?
What is used in C# to replace sprintf?


String.Format is the closet function.
Nov 16 '05 #2
The _ecvt function converts a double to string. This function stores up to
count digits of a value as a string,
The position of the decimal point and the sign of value can be obtained from
dec and sign after the call.
_ecvt(Math.Abs(val),14,&dec,&sign);
So how can I do this function call in C#, since C# does not have the _ecvt
function.

there is an append function on a string in C++, that appends a string to
another string starting at a specific position & the user can specify how
many elements to append, for example:
str1.append(str2, 1, 2);
What method in C# replaces the C++ append function?

There is a function in C++ to convert an interger to a string:
_itoa(deg, bufdeg, 10) ;
What is used in C# to replace this funtion _itoa?

Thanks
"Daniel O'Connell [C# MVP]" wrote:

"rgarf" <rg***@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
I am converting a C++ application to C#, What in C# replaces the following
C++ functions:
overloaded opertaor=


Nothing, C# doesn't allow overriding the assignment operator.
_ecvt(Math.Abs(val),14,&dec,&sign) ; //this function converts a double to
a
string & puts the position of the decimal point & the sign of value in the
dec & sign paramaters, and it lets you specify how many digits you want to
store in the string(14)


I don't understand waht you are asking here.
I noticed that the C# math library only has an abs() method not a fabs()
method, what would replace the fabs method?


Math.Abs deals with integers and floating point numbers, does fabs offer
anything else?
What is used in C# to replace sprintf?


String.Format is the closet function.

Nov 16 '05 #3

"rgarf" <rg***@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
The _ecvt function converts a double to string. This function stores up to
count digits of a value as a string,
The position of the decimal point and the sign of value can be obtained
from
dec and sign after the call.
_ecvt(Math.Abs(val),14,&dec,&sign);
So how can I do this function call in C#, since C# does not have the _ecvt
function.
I don't know about how to retreive the sign and decimal point location, but
getting a string is simply an issue of calling ToString on your double
variable.

there is an append function on a string in C++, that appends a string to
another string starting at a specific position & the user can specify how
many elements to append, for example:
str1.append(str2, 1, 2);
What method in C# replaces the C++ append function?
Depending on what you want, the various String and StringBuilder method's
will do what you want. There isn't one single method

There is a function in C++ to convert an interger to a string:
_itoa(deg, bufdeg, 10) ;
What is used in C# to replace this funtion _itoa?


the ToString() method on the int.

You should really read up on the framework, most of these questions are
quite elementary.
Nov 16 '05 #4

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

Similar topics

4
by: mustafa | last post by:
Dear sir , I have built my application in visual basic 6.0 and crystal Report8.5 , Now i migrated my application to VB.net using the upgrade wizard.My visual basic form is upgraded to vb.net...
29
by: Armand Karlsen | last post by:
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML 4.01 Transitional and CSS compliant, and I'm thinking of converting it into XHTML to learn a little about it. Which XHTML variant...
8
by: prabha | last post by:
Hello Everybody, I have to conert the word doc to multiple html files,according to the templates in the word doc. I had converted the word to xml.Also through Exsl ,had finished the multiple...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
3
by: Mary | last post by:
Hi, Does anyone know of any software out there that would convert an application written in VBScript to either VB.NET or C#/C++ quite quickly for me, or will I have to re-write the application...
2
by: Map Reader | last post by:
Greetings, I am converting an old VB6 application to use .NET. One of the old controls loads icons from the disk and displays them. However, the transparent color turns to blue somewhere in the...
12
by: Frederik Vanderhaeghe | last post by:
Hi, I have a problem converting text to a double. Why doesn't the code work: If Not (txtdocbedrag.Text = "") Then Select Case ddlBedrag.SelectedIndex Case 0 Case 1
7
by: Tor Aadnevik | last post by:
Hi, I have a problem converting values from Single to double. eg. When the Single value 12.19 is converted to double, the result is 12.1899995803833. Anyone know how to avoid this? Regards...
4
by: gg9h0st | last post by:
i'm a newbie studying php. i was into array part on tutorial and it says i'll get an array having keys that from member variable's name by converting an object to array. i guessed "i can...
2
by: shenanwei | last post by:
DB2 V8.2 on AIX, type II index is created. I see this from deadlock event monitor. 5) Deadlocked Connection ... Participant no.: 2 Lock wait start time: 09/18/2006 23:04:09.911774 .........
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
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...
1
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
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.