C# To C++ Help

How this code would look in C++, please help.
File.WriteAllText(@"test.txt", Regex.Replace(Regex.Replace(File.ReadAllText(@"test.txt"), @"-?(?<!,|\d)(?>\d+)(?!,)", "($&)"), @"-?\d+,\d+", "\"$&\""));
It doesn't have a direct translation as the code you present use .net classes not readily available in C++ in a way they can be translated "as is".

The File.WriteAllText() method is a static one. In C++ I would use a std::ofstream object to write the text.

Then there's Regex. There a regular expression in C++ TR1 and C++11. Those calls would have to be translated to the use of this object, but I have never used it before so I am actually unaware if there's an equivalent method for Replace.

In general, I would:

-Read the file with a std::ifstream object.
-Close the file.
-Use the C++ regex object to perform the replacements.
-Write the file using std::ofstream.
Could you give me please the code?

I just need a code, to run it in C++ i dont understand anything in C++.
Topic archived. No new replies allowed.