6,741 Posted Topics
Re: [QUOTE]When you encode something you have to decode it with the same username and password again, otherwise it will give you a very strange character text.[/QUOTE] It's called symmetric key cryptography, and I don't recommend inventing your own algorithm as it's more likely to be woefully insecure than decent in … | |
Re: [QUOTE]Should'nt this work since I am modifying only one memory location.[/QUOTE] No, it shouldn't work because string literals aren't modifiable. | |
Re: [QUOTE]However, now I have a problem with my looping because this way, I am seeing the last line *TWICE* in my output[/QUOTE] This is precisely the reason why feof() shouldn't be used as the only loop condition. It only returns true [I]after[/I] you've tried and failed to read from the … | |
Re: [QUOTE]If this were real code, I'd say go ahead and use goto.[/QUOTE] If this were real code, I'd say that it should probably be refactored into multiple functions rather than straight nested conditionals. Though I can't help but notice that there's not a loop in the example cod in the … | |
Re: >Thats not a bad post.. (Nothing wrong with dates) Assuming the bump is relevant, of course. | |
Re: [QUOTE=stiwari;1626786]Hi ArkM, can you tell me what exactly you are trying to achieve in this step: [code]p[bsz-1] = 0;[/code] Is it correct or was it supposed to be [code]p[bsz-1] = '\0';[/code] Thanks in advance for your reply!!![/QUOTE] Both will do the same thing. The integral value of '\0' is 0. | |
Re: There's not always going to be a tutorial. Design the interface to suit your needs, and if it doesn't work out, throw it away and start over. | |
Re: [QUOTE]So i'm wondering how 162 and 12 are converted to 3234?[/QUOTE] Don't forget that the 12 is your second byte, so it needs to be appropriately shifted: [ICODE](12 << 8) | 162 == 3234[/ICODE]. | |
Re: [QUOTE]C++ or C?[/QUOTE] How is that new? If you want something new, pick a language that doesn't have the same ancestry as the ones you already know. You'll get more out of it than the same old syntax with a different standard library. :icon_rolleyes: | |
Re: When somebody bumps a thread that hasn't been touched in years to post code, it's pretty much always crap riddled with poor practices. Coincidence? Probably not. :icon_rolleyes: | |
Re: [QUOTE]I want tree traversal program for given Alphabets not numbers..[/QUOTE] You should get started writing one then. :icon_rolleyes: | |
Re: Set your window to full screen, always on top, then disable the Windows and Alt keys so that the user can't switch applications. This solution obviously involves some system hooking for true full screen and disabling special keys, but Google can help you with those problems. | |
Re: I notice you don't specify an encoding, which means you're using the default. Unless you changed it in Tomcat's configuration it should be compatible with C's character type, but you can force the content type to be extra safe: [ICODE]"Content-Type: text/xml; charset=ISO-8859-1"[/ICODE]. There are a number of factors at work … | |
Re: Basic info is basic. ;) Since this is now a sticky, I'd like to see the addition of a common class of examples that tend to cause confusion: [code=java] for (int i = 0; i < N; i++) { for (int j = i; j < N; i++) System.out.println("What be … | |
Re: [QUOTE][CODE]fflush(stdin);[/CODE][/QUOTE] Please don't do this anymore. fflush() is only defined on output streams, which means your code is subtly broken. | |
Re: [QUOTE]What would happen if I (somehow) made an enum bigger than unsigned int?[/QUOTE] The compiler will attempt to adjust the underlying type according to the largest enumerator value. As for defining an enumerator value lager than the largest possible integer, good luck trying. ;) | |
Re: [QUOTE]I hear it's technically legal under newer standards, but not every compiler supports the newer standards yet.[/QUOTE] Not in C++. The current C standard (C99) supports variable length arrays, but they're an abomination and shouldn't be used. C++ doesn't support variable length arrays in any form because the standard library … | |
Re: [QUOTE]Well, that is not even close.[/QUOTE] It's an example of how to convert a string to double, which is a necessary [i]step[/i] in the solution to your problem. Don't expect someone to do all of your work for you. | |
Re: [QUOTE]I've been trying to make a reliable IRC client for a while now, and I know very little about sockets.[/QUOTE] Am I the only one who finds this sentence semantically humorous? :D [QUOTE]How is the program to know the server will send three or four lines before I should send … | |
Re: [QUOTE]I've done Java for so long now that I've forgotten some of those rules.[/QUOTE] Java has the same rule... :icon_rolleyes: | |
Re: [QUOTE]Its an assignment[/QUOTE] Not [i]my[/i] assignment. How about you prove that you've made an honest attempt to solve the problem before running here for "help". Otherwise I'll consider this thread in violation of Daniweb's homework rule. | |
Re: If you don't mind a 90 degree rotation, I use this for printing the structure of a tree because it's fast and easy: [code=c] void padding ( char ch, int n ) { int i; for ( i = 0; i < n; i++ ) putchar ( ch ); } … | |
Re: >so theres no other sytax required? You may need to clear the stream of leftover junk: [code] #include <iostream> #include <limits> using namespace std; int main() { // Your program here cin.ignore ( numeric_limits<streamsize>::max(), '\n' ); cin.get(); } [/code] Or alternatively: [code] #include <iostream> using namespace std; int main() { … ![]() | |
Re: [QUOTE]The output says: File does not exist or dictionary is empty...[/QUOTE] While that might be true, you can't be sure because your code is making an assumption about why the pointer is null. Try using perror() for more detailed information: [code] file_ptr=fopen("C:\Dictionary","r"); if (file_ptr == NULL) { perror(NULL); return NULL; … | |
Re: Perhaps it has something to do with the fact that you're using a freaking ancient compiler with a state of the art OS. Do you have a similar problem with other free compilers that were written for something newer than Windows 3.1? | |
Re: [QUOTE]p.s.: I have tried cin.clear() without luck.[/QUOTE] istream::clear() is poorly named, in my opinion. What it actually does is clear the error state flags for the stream, but it's terribly easy to assume that it clears the stream buffer. The member function best suited to clearing the stream buffer is … | |
Re: >I know that getchar(), cin, getch() commands don't allow to do that. getch (and getche) does, but it isn't a standard function and won't exist on all implementations. What compiler and operating system do you use? | |
Re: [QUOTE]Why are the first three 77's not indented?[/QUOTE] Consider the first three iterations of your loop: [CODE] cout << setw(0) << 77; cout << setw(1) << 77; cout << setw(2) << 77; [/CODE] Now go see if you can figure out what happens when the length of the printed object … | |
Re: There's not any alternative I'm aware of. | |
Re: [QUOTE]Access violation reading location 0xcccccccc.[/QUOTE] Look for an uninitialized local variable in your debugger. | |
Re: Here's a hint: subtract '0' from each digit in the string and you'll get the integer value of the represented digit. In other words, '0' - '0' is 0, '1' - '0' is 1, etc... From there it's a simple loop over the string and assigning the result to your … | |
Re: Here's a novel idea: tell us what the various errors are. :icon_rolleyes: | |
Re: Which CString? Sadly, there's more than one library with a class called CString, and they all work slightly differently. | |
Re: [QUOTE]c# - How can I raise an event every day 12:00 AM or specific time interval in c#.NET[/QUOTE] Does nobody read the [URL="http://msdn.microsoft.com/en-us/library/system.timers.timer.aspx"]documentation[/URL]? I mean, that's a classic RTFM type of question. | |
Re: >Is there a "neater" way to code the following? [code] System.out.println ( "All the values in the array are: " ); for ( T x: array1 ) System.out.println ( x ); [/code] Change T to whatever the type of the array is. Or, if you aren't up to the latest … | |
Re: [QUOTE]Can we (compile and execute) or just execute a c file from another c file?[/QUOTE] Yes. The easiest way would be to simply execute the compiler with the source file as input: [code] sprintf(cmd, "gcc %s", filepath); system(cmd); /* Compile */ system("./a.out"); /* Execute */ [/code] Otherwise you're looking at … | |
Re: Run the [ICODE]man[/ICODE] program on Linux your system, it searches for documentation. Libraries in particular are found in section 3. | |
Re: I'd recommend [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]this one[/URL], but I'm also just a little biased, having written it. ;) | |
Re: All of those are defined or typedef'd types. Are you including the appropriate headers? <time.h> and <stdbool.h> are the ones you're looking for, assuming C99. | |
Re: [QUOTE]Both issues can be solved at the same time by calling memset() to flood the array with '\0' bytes.[/QUOTE] [QUOTE]or a simple loop for (i=0; i<n+1; i++) p[i] = 0;[/QUOTE] All that's necessary is to set the first character to '\0' to make it a valid string for strcat(): [code] … | |
Re: [QUOTE]are there any tools that run c and c++ in windows 7???[/QUOTE] Just about everything except Turbo C++. You made a beeline for the worst possible compiler, congratulations. :icon_rolleyes: Try Code::Blocks or Visual C++ 2010 Express for two modern compilers that run well on Windows 7. | |
Re: [QUOTE]i know that there is no database connection with c[/QUOTE] Not standard C, but there are libraries for pretty much every database package out there. If you're planning on writing your own database rather than connecting to a database package, here are a few thoughts to get you started based … | |
Re: Case matters in C. Both printf() and scanf() are all lower case, you're trying to use functions that don't exist. | |
Re: [QUOTE]I am pretty sure that I'm not doing something wrong with this code.[/QUOTE] You forgot to include <string>, and the code also does nothing with user after the input call. The following offers some corrections, though your use of global variables is still questionable: [code] #include <iostream> #include <string> using … | |
Re: [QUOTE]Particularly in the case of older-aged employees--they may have a problem but not have a clue in the world about how to explain it to you. Normally they might ramble on and on about irrelevant details and the only part of concern is a few words out of it.[/QUOTE] Actually, … | |
Re: How are you defining "help"? You said "[b]I[/b] need to write", but neglected to do anything except post your requirements. This suggests that you want us to write it for you and give you the code. So perhaps you should tell us what you've tried so far, and how it … | |
Re: 7/3 is evaluated in an integer context, which means all precision is truncated to 0 when you assign to the float variable. Make either one of the operands floating-point and you'll get what you want: [code] a = 7.0f / 3; [/code] |
The End.