How to save this string into XML file?

The fact that it’s XML is basically irrelevant. You can save any text to a file very simply with File.WriteAllText: File.WriteAllText(“foo.xml”, xml); Note that you can also specify the encoding, which defaults to UTF-8. So for example, if you want to write a file in plain ASCII: File.WriteAllText(“foo.xml”, xml, Encoding.ASCII);

C++ vector of char array

You cannot store arrays in vectors (or in any other standard library container). The things that standard library containers store must be copyable and assignable, and arrays are neither of these. If you really need to put an array in a vector (and you probably don’t – using a vector of vectors or a vector … Read more

Java collections faster than c++ containers?

This sort of statement is ridiculous; people making it are either incredibly uninformed, or incredibly dishonest. In particular: The speed of dynamic memory allocation in the two cases will depend on the pattern of dynamic memory use, as well as the implementation. It is trivial for someone familiar with the algorithms used in both cases … Read more

Regular expressions C# – is it possible to extract matches while matching?

You can use regex groups to accomplish that. For example, this regex: (\d\d\d)-(\d\d\d\d\d\d\d) Let’s match a telephone number with this regex: var regex = new Regex(@”(\d\d\d)-(\d\d\d\d\d\d\d)”); var match = regex.Match(“123-4567890”); if (match.Success) …. If it matches, you will find the first three digits in: match.Groups[1].Value And the second 7 digits in: match.Groups[2].Value P.S. In C#, … Read more