6,741 Posted Topics

Member Avatar for Wouto1997

[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 …

Member Avatar for Narue
0
527
Member Avatar for see_bharath

[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.

Member Avatar for Schol-R-LEA
1
307
Member Avatar for ThomsonGB

[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 …

Member Avatar for ThomsonGB
0
356
Member Avatar for shwee

[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 …

Member Avatar for Narue
0
165
Member Avatar for Catweazle

>Thats not a bad post.. (Nothing wrong with dates) Assuming the bump is relevant, of course.

Member Avatar for WaltP
3
1K
Member Avatar for twek

[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.

Member Avatar for easysir
0
3K
Member Avatar for Stefano Mtangoo

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.

Member Avatar for Stefano Mtangoo
0
332
Member Avatar for some_coder

[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].

Member Avatar for some_coder
0
183
Member Avatar for eoop.org

[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:

Member Avatar for radc
0
324
Member Avatar for Sushi

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:

Member Avatar for WaltP
0
280
Member Avatar for harrismahadevan

[QUOTE]I want tree traversal program for given Alphabets not numbers..[/QUOTE] You should get started writing one then. :icon_rolleyes:

Member Avatar for Narue
0
39
Member Avatar for sam1

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.

Member Avatar for sam1
0
1K
Member Avatar for manaila

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 …

Member Avatar for manaila
0
163
Member Avatar for apines

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 …

Member Avatar for Rashakil Fol
13
1K
Member Avatar for iamcreasy

[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.

Member Avatar for Narue
0
434
Member Avatar for Zssffssz

[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. ;)

Member Avatar for vijayan121
0
147
Member Avatar for PrimePackster

[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 …

Member Avatar for PrimePackster
0
316
Member Avatar for The 42nd

[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.

Member Avatar for Narue
0
243
Member Avatar for pseudorandom21

[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 …

Member Avatar for pseudorandom21
0
153
Member Avatar for jackmaverick1

[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:

Member Avatar for jackmaverick1
0
144
Member Avatar for fast2dbeat

[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.

Member Avatar for Narue
0
177
Member Avatar for basukinjal

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 ); } …

Member Avatar for steve.lorimer
1
11K
Member Avatar for kaoss1103

>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() { …

Member Avatar for v3ga
1
2K
Member Avatar for maryam ahmad

[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; …

Member Avatar for maryam ahmad
0
1K
Member Avatar for zbar

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?

Member Avatar for tapaninyc
0
3K
Member Avatar for swissknife007
Member Avatar for blackrainbowhun

[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 …

Member Avatar for Schol-R-LEA
0
173
Member Avatar for WARburg

>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?

Member Avatar for zeroliken
0
3K
Member Avatar for coolbeanbob

[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 …

Member Avatar for Schol-R-LEA
0
226
Member Avatar for riahc3
Member Avatar for Diogo Martinho

[QUOTE]Access violation reading location 0xcccccccc.[/QUOTE] Look for an uninitialized local variable in your debugger.

Member Avatar for Narue
0
275
Member Avatar for gpraveenkr04

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 …

Member Avatar for Narue
0
50
Member Avatar for airtoncbr
Member Avatar for airtoncbr
0
407
Member Avatar for natehome123
Member Avatar for l1nuxuser

Which CString? Sadly, there's more than one library with a class called CString, and they all work slightly differently.

Member Avatar for kndubey88
0
662
Member Avatar for nav07

[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.

Member Avatar for Narue
0
77
Member Avatar for Bud4java

>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 …

Member Avatar for peter_budo
0
252
Member Avatar for sharathg.satya

[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 …

Member Avatar for Narue
0
264
Member Avatar for marcux

Run the [ICODE]man[/ICODE] program on Linux your system, it searches for documentation. Libraries in particular are found in section 3.

Member Avatar for Schol-R-LEA
0
121
Member Avatar for NoUserNameHere

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. ;)

Member Avatar for Narue
-1
87
Member Avatar for Zssffssz

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.

Member Avatar for Narue
0
74
Member Avatar for rockerjhr

[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] …

Member Avatar for Narue
0
128
Member Avatar for mcconnell_34
Member Avatar for rithish

[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.

Member Avatar for Schol-R-LEA
0
409
Member Avatar for c fan

[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 …

Member Avatar for Ancient Dragon
0
240
Member Avatar for UNDER-18 FG

Case matters in C. Both printf() and scanf() are all lower case, you're trying to use functions that don't exist.

Member Avatar for UNDER-18 FG
0
153
Member Avatar for UltimateKnight

[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 …

Member Avatar for UltimateKnight
0
101
Member Avatar for mrnutty

[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, …

Member Avatar for Netcode
1
175
Member Avatar for lrnzsmok1

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 …

Member Avatar for shubhamhaowa
0
211
Member Avatar for lastbencher

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]

Member Avatar for mridul.ahuja
0
147

The End.