3,183 Posted Topics
Re: For paths like this, they shouldn't be hardcoded in the first place. Three options come to mind that are viable and reasonably easy to implement: 1. Have the user type in the path. 2. Store paths in a configuration file under the same folder as the executable. Then you can … | |
Re: Try using the -ansi switch. You mentioned Dev-C++ earlier, which suggests MinGW, which I recall was broken in some areas of the stdio library. | |
Re: You mistyped the code from the book. The format string for double in scanf() is "%lf", with a lower case L, not 1. For printf() it's just "%f". Adding 1 to either of them introduces a field width, which you probably don't want. | |
Re: > what is the best boook? The one you have the easiest time understanding. All books will get you started. Some are better from an experts view, but may not be suitable for all beginners because everyone learns differently and understands different explanations of the same concept. It's actually more … | |
Re: I don't think 7 seconds is outrageous for almost 13 million runs of that loop. Do you have a reason for increasing the speed or is it just premature optimization? | |
Re: It seems like you're looking for a [Soundex](http://en.wikipedia.org/wiki/Soundex) type of algorithm. | |
Re: > What kind of skills / tutorials should I brush up on over the summer to try and gain programming skills that I might need? You'd need an extraordinary amount of talent to pick up programming well enough over a single summer to be at a professional level. Sorry, but … | |
Re: > Can anyone link me to a moderator's profile? need to ask them about something personal. [My profile](http://www.daniweb.com/members/937956/deceptikon). | |
Re: > To make it even clearer, in the C programming language, nothing in the language keeps track of the size of an array. That information does not exist once the array has been created. You can extract that information, *iff* you have access to the array object itself (a pointer … | |
Re: > Admittedly with 951 down voted posts, it appears he/she is doing something wrong Note that the vast majority of those votes were made by a single person. When looking at votes, also look at the unique voters. If the number of votes is high and the number of voters … | |
Re: > Why not get rid of down voting altogether? In reality, and has happened, someone could down vote out of malice, or because they don't know what they are talking about. Any feature can be abused. Should we punish *everyone* for the actions of one or two outliers? Concerning the … | |
Re: > <grammar Nazi hat on> "intergers" is correctly spelled "integers". </grammar Nazi hat on> <über pedantic mode> You need to wear your *spelling* Nazi hat because using the correct word in the correct context with incorrect spelling is not a grammatical error, it's a spelling error. </über pedantic mode> :D | |
Re: Does the article watch feature not suitably do everything you want? It doesn't bookmark specific posts, but finding the post in an article shouldn't be a problem for all but the ones with many pages. You can also click on the time posted link (at the top left of each … | |
Re: > If the elapsed time is greater than something reasonable (say 4 weeks) , prompt the current poster to consider making a new thread or even disallow said posts We already put up a notification on the quick reply for older threads, any more than that would be excessive, I … | |
Re: Unfortunately this isn't the kind of variation that scanf() is designed to handle gracefully. What's happening is scanf() is detecting the sentinel character before saving any characters for a field, thus an empty field denotes failure to perform the conversion for the scanset. You'll need to check for two adjacent … | |
Re: > when I read it how can I find out there was an endline or not ? How do you plan to use that information once you get it? That will somewhat determine what method you use. For example, you can run through the file character by character and look … | |
Re: > Jim you could always try something like http://ideone.com/ to help with the guessing, no clue if it is any good though! It's not up to any serious development, but for quickie test programs it's quite useful. I often use it for PHP because with my dev environment the alternative … | |
Re: Realistically, a sorted array would be advantageous if you want to get a sorted listing of items, or do a ranged search or anything except an exact match. If all you're doing is searching onesie twosie, the hash table is conceptually faster. In practice the array and a binary search … | |
Re: Don't reset `upper`, `lower`, and `digit` inside the loop. You only care that *any* character matches, so after it's set to 1, that's a match for the whole string. If none of the characters match then it'll remain 0 regardless. | |
Re: > The question states that each candle burns completely in one hour. That doesn't mean that after half an hour the candle is half gone. If the candle is wider at the bottom than the top, it could take 20 minutes to burn through half its height and 40 minutes … | |
Re: Line 10: Often if the line itself is fine, look at previous lines. In this case you neglected to terminate the previous function prototype with a semicolon. The error wasn't detected until line 10, where it caused the compiler to puke. Line 102: `numemps` is an array, but you compare … | |
Re: Most likely what you wanted was this: data[i] = data[i] + m.data[i]; Since the error suggests you don't overload the subscript operator to get the contents of `data`, you need to touch `m`'s copy of `data` directly. | |
Re: Are you talking about just displaying a picture any way that works, or actually rendering the picture using C++? The former is vastly simpler; you can just start the process of a picture viewer and pass in the location of the picture to open it. The latter is quite a … | |
Re: Well, the error says that your query is wrong, so that's a good place to start. ;) My guess would be because Access is having trouble parsing "Tel number", and surrounding it with brackets would fix the problem: string myQuery = "INSERT INTO Parent( Name, Surname, Address, Postcode, [Tel number], … | |
Re: > Yup, it works now, with .clear() :). Thanks! As a side note, the reason for that is the status flags of a file stream object are independent of the file that it points to. So if you open a file successfully, read it to EOF, then close it, attempting … | |
Re: > C style strings are pointers to characters Add "sometimes" in there any I'll agree with you. The definition of a string in C is a contiguous sequence of zero or more characters terminated by '\0'. That means you can represent a string with an array (note that arrays are … | |
Re: > Is it possible to make drivers from scratch in assembly and how easy is it???? Yes, of course it's possible. How easy it is depends on what the driver does, but it's generally a safe assumption that any production quality driver written in assembly wouldn't be described as "easy". … | |
Re: > Are we going to get a new Christmas theme for the site? Sounds like a hassle, both technically and in dealing with complaints from people who don't celebrate Christmas and are mad that we didn't come up with a skin just for them. ;) > So it's like good … | |
Re: Could you be a little more specific as to *what* exactly the error is? All I see is code and vague references to "something's wrong". | |
Re: Well, you could probably go through the minutes of the committee meetings, but I think in this case the rationale is pretty obvious. It's closing an consistency hole in the standard library where there's not an overload for both C-style strings and C++ strings. | |
![]() | Re: Something like this comes to mind as a first attempt: #include <cstdlib> #include <fstream> #include <iostream> #include <string> int main() { std::ifstream in("test.txt"); if (in) { std::string header; while (getline(in, header)) { if (header.empty()) continue; // Discard empty lines int changes = -1; if (!(in>> changes)) { std::cerr<<"Invalid file format\n"; … |
Re: http://en.wikipedia.org/wiki/Non-breaking_space A little digging suggests something like `variable.replace(/\xc2\xa0/g, '')` as a solution with the way I assume you're handling encodings. You may need to tweak the code a bit as I'm not super hip with Javascript. | |
Re: > now I'm getting two other errors: Which you neglected to post. | |
Re: > I needed some clarifications w.r.t making functions thread safe. Can you be more specific? | |
Re: > The reason yours won't compile is because two stars means a 2d array I'd disagree there because it'll cause confusion when trying to assign a 2D array to a pointer to a pointer: int a[2][3]; int **p = a; // Still won't work! The problem is that the type … | |
Re: > Is there a way around this? Run each dude in its own thread of execution. Or write Wander() so that it handles steps rather than the whole random wandering that I assume it does. That way you can process one step for each NPC in sequence and it'll appear … | |
Re: It means print either doesn't exist entirely or doesn't have a definition. Presumably it's a function, which means you probably declared it but didn't define it. | |
Re: > Usually at school, where we use turbo c++ (Horrible) the file could be seen in the folder where the cpp file is saved...... Visual C++ does the same by default. Try running a simpler test: #include <fstream> int main() { std::ofstream out("fooby.txt"); } On my system that program places … | |
Re: Are you using multiple inheritance? Off the top of my head I don't recall if the C++ standard requires the base and derived object address to be the same for single inheritance, but it simply *cannot* be for multiple inheritance. There's no way to organize the structure of the object … | |
Re: Start easier. Can you define an array of 500 SREC objects? | |
Re: Presumably the language required by your mobile platform. For platforms that support multiple languages, choose the one you're most familiar with. If you're not familiar with any of them, I'd suggest using the one that's most pervasive as it'll be easier to learn and get support on. | |
Re: Would it be wrong of me to assume that you'd benefit from looking at [an implementation of a standard library function](http://code.google.com/p/c-standard-library/source/browse/src/std/stdlib.c#327) that can handle this? If so, I can shrink it down to the necessities and explain what's going on. | |
Re: > The admins don't seem to really care. I care that you had a hissy fit and I called you on it. I don't care that somebody told you they wouldn't do your project as that's not against the rules. Ignore it if you don't like it, report it if … | |
Re: void foo(void); // Declaration void foo(void); // Declaration (redundant but legal) void foo(void) {} // Definition void foo(void) {} // Definition (redundant and illegal) A function definition is where you give the function a body. A declaration has no body and only lists the function signature (return type, name, and … | |
Re: Possible, but not directly. The two options are basically to convert the number to a string and index that, or write a function that separates the number arithmetically and returns the digit at the selected index. Edit: Just for giggles, here's a fun example. :) #include <algorithm> #include <cstdlib> #include … | |
Re: SelectedRows won't necessarily be populated from a cell event. You could use SelectedCells[i].OwningRow to get your "selected" row and attached cells: private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { var row = dataGridView1.SelectedCells[0].OwningRow; guest_id.Text = row.Cells[0].Value.ToString(); first_name.Text = row.Cells[1].Value.ToString(); last_name.Text = row.Cells[2].Value.ToString(); txt_gender_status.Text = row.Cells[3].Value.ToString(); txt_martial_status.Text = row.Cells[4].Value.ToString(); phone_numb.Text = row.Cells[5].Value.ToString(); … | |
Re: At a glance it doesn't seem like the Python code uses anything that's terribly difficult in C#. What parts are you having trouble with? Do you know both Python and C#? | |
Re: That's kind of an awkward design. Let's say you're hashing integers, you could do something like this (assuming the class works like I think it does): HashTable<int> ht(-1); It says that the hash table will use -1 as the "item not found" marker value. The idea is that the argument … |
The End.