[Solved] class object initialization in c++

[ad_1] For case 1 the A object instance is created on the heap, while the location of the variable c depends on if it’s a global, member or local variable. [Note: Question edited, case 2 totally different]For case 2 no object is created, as it is a function declaration. For case 2, the location of … Read more

[Solved] Converting c# to VB [closed]

[ad_1] You should try with this free online tool: http://www.developerfusion.com/tools/convert/csharp-to-vb/ It converts C# to VB.net (and vice versa) and has served me well in the past, apart from some rare unhandled cases it has always done a correct conversion for me. As for analyzing your code: if you don’t include the original C# to make … Read more

[Solved] How can i copy elements in list to an array c/c++

[ad_1] is that if there is anyway to copy those elements from list to an array Yes, there is a way to copy objects from a container to another. You can use the following algorithm: get output iterator to the output container get input iterator to first element of the input container while input iterator … Read more

[Solved] Name does not exist even though declared [closed]

[ad_1] You need to declare it outside static int IntCheck(string num) { int value; int NewValue; if (!int.TryParse(num, out value)) { Console.WriteLine(“I am sorry, I thought I said integer, let me check…”); Console.WriteLine(“Checking…”); System.Threading.Thread.Sleep(3000); Console.WriteLine(“Yup, I did, please try that again, this time with an integer”); NewValue = IntCheck(Console.ReadLine()); } else { NewValue = value; … Read more

[Solved] Invalid read of size – C valgrind

[ad_1] Here after is a proposed solution in main() : List of the corrected errors and enhancements: 1- in the formatting output, replace %p (dedicated to pointers) by %s (dedicated to strings). 2- before storing in the output string zeile_array[d] allocate it to the len of the output text zeile including the null-terminator. 3- instead … Read more

[Solved] C++ Array out of strings

[ad_1] Since the length of the array is not known at compile time, you can not use an automatic array. The array has to be allocated dynamically. The simplest solution to copy a string into an array would be to use std::vector. However, I suspect that your desire to create an array from a string … Read more

[Solved] Converting this string to a date [closed]

[ad_1] You can do this with ParseExact by specifying the format like this: var datestring = “9/4/2015 12:09:06 PM”; var dt = DateTime.ParseExact(datestring, “M/d/yyyy h:mm:ss tt”, CultureInfo.InvariantCulture); Depending if its 9th april or 4th september you can use d/M or M/d. 3 [ad_2] solved Converting this string to a date [closed]

[Solved] How to write ”Listed Records” in a text file? [closed]

[ad_1] To keep records in a file, you write them to the file: fwrite(&variable, 1, sizeof(record), file_pointer); To read a record from a file: fread(&variable, 1, sizeof(record), file_pointer); To position to record Y in the file: fseek(file_pointer, (Y * sizeof(record)), SEEK_SET); If this is not helpful, please clarify “keep in a file”, or state why … Read more

[Solved] Api client that fetches global configuration from web.config

[ad_1] Here ya go. namespace dm2 { using System.Collections.Specialized; using System.Configuration; public class SomeApiClient { internal static NameValueCollection Config { get { if (config == null) config = ConfigurationManager.AppSettings; return config; } } internal static NameValueCollection config; } } Basically you just use a static property in a non static class…so in order to get … Read more

[Solved] Any Visual Studio Programs are not letting me code

[ad_1] Your code isn’t in a method. You cannot declare a variable and assign it separately within the class scope. You also cannot put random expressions in class scope. Change your code to this: public class PacketReader { Socket MainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP); public PacketReader() { // rest of the code here in … Read more

[Solved] scope resolution operator semantics [closed]

[ad_1] 1) What is the use of the scope resolution operator in cases like the following, when we can also define it inline? In your example, the scope resolution operator is not required when defining a method inside a class: class Box { public: double length; // Length of a box double breadth; // Breadth … Read more