3,183 Posted Topics
Re: Off the top of my head, I'm going to say that it's not possible to mix and match %f (which supports a precision) and %g (which has a zero removal rule). You'd need to use a less direct solution, such as sprintf() followed by a right trim of zeros. | |
Re: Your best bet is to try running Mono on the machine and hope for the best. However, there's a fairly strong likelihood that your code uses .NETisms not available in Mono and will require modification to port it. | |
![]() | Re: It's no longer embedded in the post, but the file is still attached. You can remove it entirely through the same process that you added it: 1. Edit the post 2. Click the Files button 3. Click the 'Delete' link next to the attached image (where the embed buttons are) |
Re: > I'd like to know if I'm doing the allocation of memory from data to new_data correctly Looks like it, at least if set is implemented the way I'd implement it using that interface. > why new_data only has one value since the memory of data was copied before to … | |
Re: > is `char** val` the same as `char* val[ ]` *Only* as formal parameters in a function definition. Otherwise, they're not. I'm assuming we're talking about parameters for the answer to your next question. > when is the formal (`char** val`) used I'll use the array notation when I'm absolutely … | |
Re: > Also please tell me about these error. You forgot to list the errors, and your title for this thread is uninformative. | |
Re: Why are you using a Textbox? Just use a NumericUpDown control with the default set to 0. Not only will this correct your immediate problem, it also saves you all kinds of trouble in verifying that the "values" are actually numeric. | |
Re: > I tried to load the above string in XMLdocument, but I used to receive an exception. You didn't follow up on the answers from your previous thead about that exception, so why should I bother trying to help again? | |
Re: > I'm not James :/ That's a good thing, because then Daniweb would crash due to overflowing awesome. ;) | |
Re: What API? Chances are good the answer to your question is yes, but it's a little vague. | |
Re: > I received an exception when I tried to pass the above string. What exception did you get and which version of the .NET framework are you compiling against? This works for me on .NET 3.5: using System; using System.Xml; public class Program { public static void Main() { try … | |
Re: > can you please explain what was the cause of error in original code. Try reading the original post. It includes a description of the problem: *"I know whats wrong though, array is merely pointing to buf, it isnt copying the data from buf, so when the data from buf … | |
Re: It's somewhat amusing how you managed to pick the two worst possible options. gets() is completely unsafe, and the latest C standard actually *removed* it from the library. scanf()'s "%s" specifier without a field width is no better than gets(). In both cases input longer than the memory can hold … | |
Re: > don't even really know Assembly but I think you should ask a question in your post, not just post random code. It's especially important with assembly because the function of a program tends to be non-obvious. I doubt most of us will know what Lab_Tutorial_1 is, after all. ;) | |
Re: > Can you please explain how your hash funcion works? The use of the numbers and letter to add to the value a. It's an integer hash described in detail [here](http://burtleburtle.net/bob/hash/integer.html). But beware, the design of hash functions is a very deep hole. | |
Re: > I know the OP did this YEARS ago, but here's how the function should look for anyone who wants to do this: Since we're talking about other people who want to do this, a table lookup is the recommended solution: #include <exception> #include <iostream> #include <stdexcept> inline int is_leap(int … | |
Re: > Or should I do this (seems overkill): You should do that. It may seem like overkill to you now, but a using statement (implicitly calls Dispose()) will flush the streams, close them, and dispose of any internally allocated resources. To do it manually would require calling Dispose() manually, which … | |
Re: Get Turbo C, install it, create a project, and write the code for it. Do you seriously think your question is meaningful? | |
Re: > Give me an example for Serialising Multidimensional array in c sharp. That's an easy one: you can't do it. Multidimensional array serialization to XML isn't supported by .NET. You'll need to use a different type such as an array of arrays or nested List<>. But once you do that, … | |
Re: > sqrt : DOMAIN ERROR > pie = + NAN > what does this mean? It means sum is negative, most likely. | |
Re: You only allocated memory for p4. p3, p2, and p1 are all still uninitialized. | |
Re: Everytime you say `new`, there should be a corresponding `delete`. Or better yet, you should use smart pointers to save yourself the trouble of figuring out when and where to release memory or worry about forgetting to do it. | |
Re: > if usrnme is wrong and pass is correct, it will say "intruder alert" If the user name is wrong, how do you know the password is correct? Systems that allow only one user are dumb. Telling intruders that they're using the correct password and only need to figure out … | |
Re: When you get extraneous garbage on a string, the problem is consistently a failure to terminate the string with '\0'. I didn't really look closely at your code, but I'm fairly confident that's the problem, so it should give you a starting point for troubleshooting. Just make sure that every … | |
Re: > as long as the new posts are relevant to the topic. The susggestion takes that into account. We still have issues with people resurrecting threads with new or unrelated questions, or with posts that have no value (eg. "Thanks for sharing!" posts). I wouldn't be surprised if a more … | |
Re: Since you're trying to keep things "clean" (whatever that's supposed to mean here), I'm guessing installing both is unacceptable. I'd suggest that unless you're using some feature in the 2008 version that isn't available in the free Express version, go with the more recent of the two. | |
Re: > but it creat error in the above line "<<list1" Are we supposed to telepathically extract the error from your mind? > friend ostream& operator<<(ostream& out, T theList); This looks odd (T here should be the type of the class), but I'm not confident saying for sure since you provided … | |
Re: The enter key is a character too, yet you don't account for it. | |
Re: > I want to know that since the sizeof is compile time operator then why does thee above code outputs 4 even though the call to foo() will be made at runtime. You'll notice that foo() *isn't* called when used as an operand to sizeof: #include <stdio.h> int foo() { … | |
Re: > yeah but i have very short time to submit it so i ask like that :) Last I checked, that wasn't a viable excuse for cheating. Please read our rules. When posting homework questions, we *require* proof of effort before you'll be offered any help. So even though you're … | |
Re: scanf("%d", &t); And scanf("%d%d", &x[q][0], &x[q][1]); Notice the ampersand (address-of operator). scanf() requires a pointer to an object, and you were passing some random number which was extremely unlikely to be a valid address in your address space. | |
Re: Technically all you need is the compiler and a text editor. In fact, it's usually recommended that you get comfortable doing everything from the command line before moving to an IDE because the IDE, while more productive, tends to hide things from you. | |
Another quickie. This is a basic class for working with Windows path strings. It's based off of .NET's System.IO.Path class, but doesn't contain any API dependencies (and thus doesn't normalize the paths, it's all straight string handling). Methods that I've personally found to be useful are included. The class is … | |
Re: By using the at() member function, out of range indices will throw std::out_of_range. So I'd wager `i` is out of range for the `reservations` vector given that `i` is bound to the size of the `user` vector. Though you've also got some fun looking scope hiding going on with `i` … | |
Re: The Legacy Languages forum doesn't have a specific language parser, so what you see is default coloration, and the quote operator is being parsed as a string rather than the Scheme quote operator. Obviously you can fix it by being explicit with `(quote [...])` instead of `'[...]`. Unfortunately, introspectively looking … | |
Re: Why so many levels of indirection? The top two clearly aren't necessary within this program, so you could just do this: int **p = new int*[rows]; for (int i = 0; i < rows; i++) p[i] = new int[columns]; | |
Re: What's wrong here: while(temp!=NULL){[...]} temp=add; If temp is NULL after the loop then it no longer refers to the tree in any way. So assigning add to temp will accomplish absolutely nothing when insert() returns. This was actually a stumbling block for me when I first started learning referential data … | |
![]() | Re: > A great many programmers do not know what a compiler or a linker is either. Maybe I'm just an optimist, but I'd challenge that statement with the caveat that "programmer" refers to someone who has seriously attempted to learn programming and isn't a rank beginner. I find it difficult … |
Re: Have you tried: s = '0' + s; That's assuming you're using a std::string object. For C-style strings I'd recommend not using them because it makes just about everything harder. | |
Re: > I think it was 30 years ago, before the first c++ standards. C++ never supported void main() officially, even at the time of C with Classes. That was always a compiler extension, just as it is now. >> I think the standard says that main() will return 0 automatically. … | |
Re: `sizeof` is meaningless for strings. At best you'll get the size of an array, which may or may not correspond to the length of a string contained within that array. At worst you'll get the size of a pointer or the size of the containing object (eg. std::string), neither of … | |
Re: > As I am completely a newbie in this I want to know where to start. I'd start by figuring out how a website might be blocked, regardless of which browser makes the request. > Please provide me with any useful links which can help me. [This link](http://www.google.com) is probably … | |
Re: > ya k tinstaafi i am the new one to dot net plat form , i dont know exactly what is what thats why i am asking again clearly If you don't read the links, which have far more extensive information than a post here would contain, what makes you … | |
Re: I imagine it would be a good job for experience as you're likely to be doing most of the grunt work. | |
Re: > want to convert this program into c language :( And it only took three posts to get to the root of the problem. :rolleyes: Anyway, you need to recognize that C doesn't have a dynamic array library like C++'s std::vector. So you really have three options: 1. Find a … | |
Re: > @moschops i am trying to avoid that loop. thats why i am using memset which fails. What do you think memset() does? Internally it's just a loop. There might be some unrolling involved or it might be written in assembly to speed things up, but it's still a loop. … | |
Re: If you're too lazy to figure out what project you want to do, the project will be stillborn because you're clearly too lazy to actually *do* the project. | |
Re: What's `musorv_uzi`? If it's a variable then you probably intended to say `$arr222[$musorv_uzi]`. If it's a string, you need to quote it. Presumably it could be a constant as well, but it's clearly not defined in the current scope. | |
Re: Are you asking about mov in general, or are you asking specifically about moving the low order byte of a register? | |
Re: If it's not working, have you considered fixing it instead of asking for something completely different? Or is it that you stole that code from somewhere and aren't capable of fixing it? I can tell you right now that `(a[i])^3` is meaningless because ^ is a bitwise XOR operator, not … |
The End.