[Solved] SIGABRT called when calling find() on a string element in an array [closed]

It’s pretty simple why it’s crashing when you change that line. In the version that crashes you check whether words[j].find(new_word) is equal to std::string::npos and then call s.erase(s.find(new_word), …). Of course, s.find(new_word) could still be std::string::npos, and string::erase throws an exception when the first argument is out of range. In the version that you say … Read more

[Solved] Berkeley DB C++ showing incorrect key-value string data

Solution was to change datatype of key values from constant character pointer const char * to char array. char fruit[sizeof(“fruit”)] = “fruit”; char apple[sizeof(“apple”)] = “apple”; Additionally , even using string instead of const char * for key-values gives similar issue as mentioned in the question, somehow I could make it work only with char … Read more

[Solved] Error while compiling the code ‘double free or corruption (out)’ using threads in C? [closed]

The *fp is a global variable, so each therad will initialize it with fopen and after finished working try to close it. the *fp is shared between threads (which should not be) so each thread before exiting tries to close the file handle stored in *fp and the double free occurs when multiple threads tries … Read more

[Solved] Operator ‘

Get extension is a function and you have < between it and its () Replace this: string sFileExt1 = Path.GetExtension < (objFI[0].Name); With: string sFileExt1 = Path.GetExtension(objFI[0].Name); 3 solved Operator ‘

[Solved] SQL – Failed to convert string to Int32

You are probably passing a value that can’t be parsed into an int for this parameter: pram[5] = new SqlParameter(“@contact”, SqlDbType.Int, 100); Check what you are passing here: pram[5].Value = contact; If contact is a string then do something like: int contactNumber; pram[5].Value = int.TryParse(contact, out contactNumber) ? contactNumber : 0; 4 solved SQL – … Read more

[Solved] Extension method to throw new Exception

I believe this is what you’re looking for. The jist is, the compiler needs to verify statically that you’re returning something from every code path. Because you’re using this extension method, it’s not able to deduce the fact, and you’re getting the error: CS0161 ‘Foo()’: not all code paths return a value solved Extension method … Read more

[Solved] In .net store the data in textboxes [closed]

Rather than storing data in an asp:TextBox, you should consider some other methods of storing values. For example, you can use the HttpApplicationState class in System.Web to store a variety of different data types. If you wanted to store a DataTable using this method, you could do so by doing something like this in C#: … Read more

[Solved] If entire c# code is converted to one line and compiled would it decompile to 1 line?

c#.net compiles to MSIL. In MSIL both examples are represented exactly the same. Something along the lines of load variable blahblah load constant 123 compare for equality MSIL doesn’t care about whitespace. Decompilers simply translate MSIL back to C#. Both examples would decompile the same, since they both generate the same MSIL 1 solved If … Read more

[Solved] Insert linked list

In your Insert function, you never allocate newNode. Node* newNode; You need to allocate it like so: Node* newNode = new Node(); The program runs correctly after fixing this, and the output is: 24 http://ideone.com/16XL5W EDIT: Regarding your comment below, the following lines do not allocate anything: Node* newNode; struct Node* newNode; They are simply … Read more