3,183 Posted Topics
Re: Wildcards are interpreted by the shell before your program gets a chance to touch them. If you want them passed as literals, then escape them so that they're not interpreted as wildcards: $ python ./arch.py install \* | |
Re: > There is no pass by value when it comes to a function with array as the parameter. It's the other way around. There's no pass by reference in C, period. When passing an array, you're passing the address as a pointer *by value*. | |
Re: Sorry, we don't allow discussion of hacking on Daniweb. | |
Re: > `define('DB_NAME', 'lol);` Count the single quotes in that line. | |
Re: > You should use <iostream> and <cmath> (all C++ standard headers don't have the .h, and all those taken from C (like math.h, stdlib.h, stdio.h, etc.) also omit the .h and are prefixed with the letter c). It's also important to remember that some compilers (Microsoft's in particular) "helpfully" don't … | |
Re: > With three programming courses under my belt will I be able to find a job out there in the real world? Getting a programming job has less to do with how much you know about programming and more to do with selling yourself. So while I'd say that right … | |
Re: At its simplest you'd have something like this just to store the characters: #include <stdio.h> #define EXPR_MAX 255 int main(void) { FILE *in = fopen("c:\\test1.txt", "r"); if (in) { char expr[EXPR_MAX]; size_t n = 0; int ch; while ((ch = getc(in)) != EOF) { expr[n++] = (char)ch; } fclose(in); /* … | |
Re: So...is your question how to turn these classes into templates? | |
Re: Using the initializer list you can take advantage of initialization rules: #include <iostream> using namespace std; struct a { double id; int tag; char array[10]; }; int main() { a var1 = {100, 1, "The City"}; a var2 = var1; cout << "var2.id = " << var2.id << endl; cout … | |
Re: > But can you tell me why in the definition of f1 (in your code) p's address has not been passed and still it's passed by reference? The entire point of using another level of indirection is so that you can access the original object. If you already have that … | |
Re: [Read the documentation](http://msdn.microsoft.com/en-us/library/windows/desktop/aa376868(v=vs.85).aspx), it includes [an example](http://msdn.microsoft.com/en-us/library/windows/desktop/aa376871(v=vs.85).aspx). | |
Re: So you're supposed to do this project, but you're asking for someone to send it to you? I'm sorry, but that sounds a lot like you're asking others to do your project for you. | |
Re: Assuming the time part of your date is consistent (such as midnight), it's a simple check against getdate(): "select * from usernames where [Username] = '" & TextBox2.Text & "' and [Password] = '" & TextBox1.Text & "' and [ExpiresOn] >= getdate()" You might also consider using parameterized queries instead … | |
Re: > Yes, it is possible but it is not recommended. Why? > It is better to have dynamically allocated array in this case. Again, why? Please assume that the compiler supports C99, since the obvious "it's not portable" prior to C99 is obvious. > `int *array = malloc(i*sizeof(int)); // alloc … | |
Re: According to [the manual](http://msdn.microsoft.com/en-us/library/70x4wcx1.aspx) WriteLine() returns void, you can't assign that to `answer[i]`. | |
Re: I assume you're asking about the ternary operator. This: 'left': (direction === 0) ? '-100%' : '100%' Is roughly equivalent to this: if (direction === 0) { 'left': '-100%'; } else { 'left': '100%'; } So it's just a expressionized version of an if..else statement. | |
Re: `continue` is a keyword in C++. Use a different name. | |
Re: > What I don't understand is, would a real world program have a default constructor AND a constructor with parameters? Certainly, if there's a case where the class could initialize itself to a predictable state without help from the caller. One example might be an empty string, so std::string has … | |
Re: [How would you do it on paper?](http://www.wikihow.com/Convert-from-Decimal-to-Binary) The first task is to understand the problem and solve it manually, step by step. Then you'll be in a better position to translate those steps into C++. | |
Re: > I would appreciate it if someone can put more detailed comments in this source code to help me better understand it. Sorry, but no. There won't always be someone around who's both capable and *willing* to read, understand, and recomment large amounts of code just to make things easier … | |
Re: Both...not at the same time though. I'm a tea snob, but I also love a nice cup of joe. | |
Re: Manually? With Excel scripting? Using third party code using an Excel library? Your question is specific as far as what you want to happen, but vague in terms of how you're looking to accomplish it. | |
Re: Pointers are built-in types, they don't have constructors per se. If you want your ppointers to be null, make them null explicitly. student *head = 0; student *tail = 0; Assuming those pointers are members of another class then you can certainly use the default constructor to make them null.: … | |
Re: > The most common password is "123456" I used "12345" for the longest time on my Hotmail account. Then they changed the requirement to 8 characters and it became "12345678". :D p.s. I use a much stronger password now, so don't bother trying either of those. > I use almost … | |
| |
Re: > i dont know how to go about it Please read [this thread](http://www.daniweb.com/software-development/csharp/threads/448647/new-programmers-what-resources-are-available-to-you). It's about C#, but the general message is very relevant. | |
Re: > _getcwd() is a win32 api function. Not sure the replacement for *nix getcwd() in <unistd.h>. ;) For processing the contents of a directory, you'd probably end up using opendir(), readdir(), and closedir(): DIR *dir = opendir("."); if (dir) { struct dirent *info; while ((info = readdir(dir))) { cout << … | |
Re: Keep a running sum of the numbers, that way you can keep a single variable for the currently entered number and reuse it in a loop. | |
Re: Start by listing the features you want to support, as those will tend to dictate your implementation more than anything. ![]() | |
Re: Handle the [form closing event](http://msdn.microsoft.com/en-us/library/system.windows.forms.form.formclosing.aspx). | |
Re: Of the listed languages, Perl is the closest to C/C++. Python and Lua are syntactically in different families. By the way, if by "hacking" you mean breaking into systems and such, please note that Daniweb does not allow that kind of discussion. | |
Re: Here's a simple example: #include <iostream> class foo { public: virtual void action() const { std::cout << "foo\n"; } }; class bar: public foo { public: virtual void action() const { std::cout << "bar\n"; } }; class baz: public foo { public: virtual void action() const { std::cout << "baz\n"; … | |
Re: > It may seem clever but I find it condescending ("Don't worry about how it's done. It's magic - whoo") and unprofessional. As for your reasoning, I don't completely agree: * Condescending: That's a problem with your sensibilities, not the word choice. Changing it to "automatically" doesn't change the fact … | |
Re: Everything *must* be declared before it's used. A function prototype is the function signature without a body and terminated by a semicolon: #include<conio.h> #include<stdio.h> #include<math.h> int input_data1(void); void display(void); void main(void) { input_data1(); } int input_data1(void) { int input; printf("\n\n**************CPU Scheduling*************\n"); printf("|\tChoose CPU Scheduling:\t\t|\n|\t1. Shortest Job Next\t\t|\n|\t2. First Come First … | |
Re: > Home sick in bed with a cold. You work too hard. Well, then again it could also be that you just party in the city too often. ;) | |
Re: I've been using Windows 8 exclusively at home for a few months now and haven't experienced any problems in IE, Chrome, or Firefox. The problem you're describing sounds a lot like a zoom issue. Reset your zoom (usually with something like ctrl+0) and see if that fixes the "awkward". | |
Re: There are a number of problems with your code. Most notable are the sort doesn't actually sort, you're not actually using an array, and inputFromUser() is storing data in a local variable that gets leaked away on every iteration of the loop. Worse, you're in SortArray() assuming that this not … | |
Re: Sometimes it takes several seconds to fully submit the post and refresh the thread. How long did you wait before concluding that the post was not submitted? | |
Re: > void permit a function without return type.... `void` *is* the return type. You just can't do much with it. > Just to add, it is not considered good programming to write void functions That's not true at all. Please don't conflate your own personal preferences with generally accepted good … | |
Re: > was it 3 hours before the big update you did a while back or was i just plain wrong? Nope. If memory serves me it may have once been 15 minutes, but was never more than 30. | |
Re: > This blog is created for the students of computer field and sharing the programming concept to the people of IT. That's a shame. In a perfect world, people would learn before trying to teach. Kudos for going to the effort, though. | |
Re: Ask him to draw it for you. | |
Re: Let's start with [int 21h](http://www.ctyme.com/intr/int-21.htm), because it seems like magic if you're not familiar with the multipurpose functionality. It behaves differently depending on the value of the AX register. mov is just shuffling data around, I'm not sure I need to explain it unless you have a specific question. Line … | |
Re: http://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references | |
Re: > Check out fseek() to smartly maneuver around a file. Note that arbitrary seeking on a stream opened in text mode is technically undefined. To use anything except an offset of 0 or the result of a previous ftell() call, the stream must be opened in binary mode. > Also, … | |
Re: In text mode the newline sequence will be converted to '\n', this is true for any platform. In binary mode you're on your own, no translation will occur so on Windows you need to look for and handle newlines in the form of CRLF. But it's problematic because you can … | |
Re: Clearly not an interview question as such a question would be illegal (in both your country and mine). | |
Re: > Please tell me how to optimise. Delete the printf() line. I/O constitutes some of the most, if not *the* most time intensive operations. On a side note, your code exhibits undefined behavior by accessing uninitialized memory. There's no guarantee that the program *won't* crash intermittently. | |
Re: Just to be clear, are you using Turbo C++ because you're forced to by a teacher or employer, or because you've chosen to use it? Because if it's the latter, I'd *strongly* recommend installing a compiler that isn't over 20 years old. |
The End.