|
sreecahitu wrote: We are going to start a migration project, i,e from C++ to C#, i do not have any idea on C++ absoultely
How can you possibly undertake this work if you don't understand C++? Do you seriously expect to gain an understanding of such a complex language from a single forum post?
Your company has serious problems if people are assigned to projects that they don't have the technical skills for.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
pmarfleet wrote: Your company has serious problems if people are assigned to projects that they don't have the technical skills for.
That's how it's done nowadays, have you not noticed ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
We produce a product which assists with this (named very creatively as 'C++ to C# Converter'), however as the others have noted it is futile to attempt this if you don't already have a very good grasp of C++. A converter helps with the grunt work, but the most complex aspects of conversion are the areas that often need some manual adjustments and if you don't know C++ you'll have great difficulty ensuring that the original functionality is preserved. Also, some C++ code simply cannot be converted to C#.
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
Java to VB & C# Converter: convert Java to VB or C#
|
|
|
|
|
Dear Guy
i have one suggestion for this, y u need convert ur project to C#?.C# have great feature p/Invoke.So uc an invoke in ur c++ dll function within C#. don't need convert to ur code , create unmanaged dll, then call in c# code with P/Invoke.
|
|
|
|
|
I'm reading a text file using a stream read and my code goes like this
<br />
FileStream file = new FileStream("c:/data/theData.txt", FileMode.Open, FileAccess.Read);<br />
StreamReader streamReader = new StreamReader(file);<br />
<br />
String line = streamReader.ReadLine();<br />
<br />
while (line != "")<br />
{<br />
if (line.Equals("<data>"))<br />
{<br />
.....
}<br />
<br />
line = streamReader.ReadLine();<br />
}</data>
the problem is that whenever i run my program, this error occurs on runtime:
"Object reference not set to an instance of an object" and it's pointing at the
"if(line.Equals(""))"... what's wrong? i used to do this in java and it works..
|
|
|
|
|
Silvyster wrote: while (line != "")
{
// check the value of the line
if (line.Equals(""))
Why are you checking it both ways ? What happens if you step through the code ? Why are you using .Equals ?
File.ReadAllLines is the easiest way to get your file as an array of strings.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Silvyster wrote: streamReader.ReadLine();
As the documentatio states:
"
Return Value
The next line from the input stream, or a null reference (Nothing in Visual Basic) if the end of the input stream is reached.
"
Ordinarily, reading through a text file and doing something with the non-empty lines would be written as:
String line ;
while ( ( line = streamReader.ReadLine() ) != null )
{
if ( line.Length == 0 ) continue ;
.....
}
|
|
|
|
|
Thank you this time it worked... I wonder why that first guy who replied keeps on asking why I do this and do that, why does he care?, it's MY PROGRAM.. and I WANT IT THIISS WAYYY... nobody can stop my creativity
|
|
|
|
|
Thanks.
Silvyster wrote: keeps on asking why
Because you should be able to read the documentation to determine what the problem is.
Silvyster wrote: it's MY PROGRAM.. and I WANT IT THIISS WAYYY
But your way didn't work very well, did it?
|
|
|
|
|
yeah the documentation is like a lot of pages and I believe this website makes things for programmers to learn easier and better. yeah my program didn't work but at least the way you modified it, makes sense. I mean THAT other guy is already giving me alternatives, BUT I dont want alternatives, I want SOLUTIONS
|
|
|
|
|
OK, remind me not to help you again.
|
|
|
|
|
hi, if I use the following code, even if I saved the txt file to Ansi codepage instead of UTF8, the StreamReader sr always gets UTF8 encoding and thus returns [239][187][191] which is UTFS-8 ByteOrderMark value. Ansi or other encodings than UTFS-8 w/BOM should not have those values. Can anyone please help me how to correct this to return correct current encoding of a file?
using System;
using System.IO;
using System.Text;
class Test
{
public static void Main()
{
string path = @"d:\work\ansi.txt";
try
{
if (File.Exists(path))
{
}
using (StreamReader sr = new StreamReader(path, true))
{
byte[] byteordermark;
while (sr.Peek() >= 0)
{
Console.Write((char)sr.Read());
}
byteordermark = sr.CurrentEncoding.GetPreamble();
ShowArray(byteordermark);
}
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
}
public static void ShowArray(Array theArray)
{
foreach (Object o in theArray)
{
Console.Write("[{0}]", o);
}
Console.WriteLine();
}
}
|
|
|
|
|
|
I am looking for some suggestions. What I am trying to do is basically update a form every X milliseconds. The example I am working with at the moment is an attempt to report the current mouse position in a text box in a form. I am actually looking for two responses. All of this is mainly for the sake of learning something new, so the details are not really what is important.
Here's an example of what I am doing now:
<br />
while (someCondition)<br />
{<br />
UpdateCursorPosition();<br />
Thread.Sleep(30);<br />
}<br />
Where "UpdateCursorPosition" could as well be "DoStuff".
The problem as you can imagine is that the form would always be unresponsive to user input (for obvious reasons). How can I do this right, so that the window is responsive, and I get a continuous update? As I said, the details are not that important, just the concept.
On a side note (the second question) , is there a way to get an "OnMouseMove" event for the desktop?
modified on Saturday, April 12, 2008 10:09 PM
|
|
|
|
|
You can capture the mouse, and hten you'll get mouse events even when the mouse leaves your form.
You can set a timer and use the method that it calls to check the mouse position.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
hi there,
i'm new in programming with C#, does anybody know what is the connecting string ADO.NET for MySQL in C#?
thanks a lot
|
|
|
|
|
Connection strings are language neutral, they have nothing to do with C#.
http://www.google.com.au/search?sourceid=navclient&ie=UTF-8&rlz=1T4ADBS_enAU225AU226&q=MySQL+connection+string[^]
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
*Grin* that was the first hit in the google search I linked to
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
|
Dear ALL
now i have a LAN + router , and i want to make a software in a certain PC to be able to access the router & get its Configuration & save it to the PC harddisk every a pre-defined period
how could i do that?? the diff. point is how to get the conf. from the router ??
i though of using telnet but i failed to get the router CLI commands to be able comm. with it ( its DLINK ADSL router - DSL-520T - )
any tips
thanks
bye
|
|
|
|
|
I have a representation of a byte stored in a string e.g. "0x08" which I want to convert to a byte.
I must be missing something really obvious here even after googling for 45 minutes.
I have not been able to use byte.Parse("0x08") as this requires an integer.
I tried int.Parse("0x08") but the string cannot be converted so that I could then use the previous method.
Any help appreciated.
Guy
You always pass failure on the way to success.
|
|
|
|
|
You could try:
var number = "0x08";
var integer = int.Parse(number.Substring(number.IndexOf("x") + 1), NumberStyles.HexNumber);
|
|
|
|