6,741 Posted Topics

Member Avatar for Firsum

To be honest, the code is very poorly written. There's no discernible structure, almost to the point of calling it spaghetti code, and you go about things in a highly manual way. I won't go into specific coding advice because I'm totally disinclined to read through over 2000 lines of …

Member Avatar for jember
0
358
Member Avatar for PCSAWICK829

[QUOTE=death_oclock;1445346]Try using [ICODE]printf("Greetings, human!");[/ICODE] (just a guess, honestly)[/QUOTE] That's subtly different because you didn't include a newline at the end. While printf is the function you'll see most in hello world programs, puts works just fine.

Member Avatar for anirudh33
0
255
Member Avatar for justinwarner
Member Avatar for Stefano Mtangoo
0
293
Member Avatar for Narue

It's not uncommon to have a mental image of people online that is a complete mismatch with their real world appearance. I thought it would be interesting to see how different members of Daniweb are perceived by their peers. Pick any members you find interesting and describe how you imagine …

Member Avatar for bumsfeld
6
256
Member Avatar for Dorson8009

If this is a serious project (as opposed to something for learning Unicode), I'd suggest [URL="http://site.icu-project.org/"]ICU[/URL]. Managing Unicode is a bitch without a good library.

Member Avatar for Dorson8009
0
169
Member Avatar for iamthesgt

The following is a common error: [code] #include <algorithm> #include <iostream> #include <string> #include <cctype> int main() { std::string line; std::cout<<"Enter a line: "; if (getline(std::cin, line)) { std::cout<<"Before: "<< line <<'\n'; // This is wrong! std::transform(line.begin(), line.end(), line.begin(), std::toupper); std::cout<<"After: "<< line <<'\n'; } } [/code] What's the problem? …

Member Avatar for mrnutty
0
218
Member Avatar for vineeshvs

You need braces around the outer loop in main: [code] for(i=0;i<2;i++) { printf("\n"); for(j=0;j<2;j++) printf("%d \t",result[i][j]); } [/code] Braces may only be omitted if the loop body consists of a single statement.

Member Avatar for vineeshvs
0
249
Member Avatar for TailsTheFox

[LIST] [*]You need to include <string> to use the std::string class. [*]Your while loop in error_check is missing a closing brace. [*][ICODE]if(test_command == true)[/ICODE] should be [ICODE]if(test_command() == true)[/ICODE]. Otherwise you're comparing a pointer to a function against true. You can also remove the [ICODE]== true[/ICODE] part because it's implicit: …

Member Avatar for arkoenig
0
115
Member Avatar for Hand

Throw the object and catch by reference or const reference. There's no need for dynamic allocation. Your second example is conventional.

Member Avatar for mike_2000_17
0
133
Member Avatar for lochnessmonster

[QUOTE]it technically still stays in memory until you overwrite the previous value correct?[/QUOTE] That's one valid result, yes. [QUOTE]is the memory freed back to the O/S and the value still remain in that memory block that was used?[/QUOTE] That's also a valid result, conceptually. The problem with these questions is …

Member Avatar for mike_2000_17
0
122
Member Avatar for kikirkou

[QUOTE]I know the obvious 4 things[/QUOTE] All four of which are not strictly correct. I suspect your teacher is oversimplifying to the point of being wrong, in which case your best bet is to ask him what the six things are and why. I could speculate about the other two …

Member Avatar for Narue
0
126
Member Avatar for XodoX

What are you not sure about? And please don't say "I don't know how to start", because that's a sad excuse I see far too often.

Member Avatar for XodoX
0
202
Member Avatar for Joey_Brown

This is more of a job for something like strrchr. Assuming you have the line in memory already: [code] #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { const char *line = "This$is$my$Input$203"; const char *start = strrchr(line, '$'); if (start != NULL) { /* Error checking omitted for brevity …

Member Avatar for Joey_Brown
0
111
Member Avatar for davi0011

[B]>while(!text.eof())[/B] This is an off-by-one error because eof only returns true [i]after[/i] you've attempted to read beyond end-of-file. So you'll have one final iteration of the loop where get fails, but you still process b (from the previous iteration). You can use the result of get as a condition, which …

Member Avatar for jonsca
0
203
Member Avatar for K92

You need to make three changes for the code to work as intended: [list=1] [*]Add [ICODE]#include <string>[/ICODE] to your headers [*]Change [ICODE]char Name;[/ICODE] to [ICODE]string Name;[/ICODE] [*]Change [ICODE]cin >> Name[/ICODE]; to [ICODE]getline(cin, Name);[/ICODE] [/list] There are two problems: first, char is only a single character type, not a string type. …

Member Avatar for Narue
0
92
Member Avatar for localp

First write your C++ code with C linkage and a compatible interface: [code] #include <iostream> extern "C" void helloWorld() { std::cout<<"hello world\n"; } [/code] Compile that into an object file. Now switch over to C: [code] #include <stdio.h> extern void helloWorld(void); int main(void) { helloWorld(); return 0; } [/code] Compile …

Member Avatar for Narue
0
300
Member Avatar for localp

Are you sending both a key down and key up event? [code] keybd_event(VK_RETURN, 0x9c, 0, 0); keybd_event(VK_RETURN, 0x9c, KEYEVENTF_KEYUP, 0); [/code] Return and Enter are the same key, by the way, just with varying names printed on the keyboard.

Member Avatar for Narue
0
81
Member Avatar for xagutxu

If these are threads within the same process as opposed to threads in different processes, you can use a thread-safe data structure to share these signals. In my opinion that's easier than implementing an inter-process communication mechanism just for threads.

Member Avatar for Narue
0
248
Member Avatar for aplh_ucsc

Can you compile? Does it fail with a runtime error? Does it run successfully but with unexpected behavior? Throw us a bone here. Just posting code and asking "what's wrong?" is a fantastic way to get ignored.

Member Avatar for Narue
0
104
Member Avatar for lmytilin

A segmentation fault in this case probably means you accessed one of the arrays out of bounds. Start up a debugger and keep a watch on your indices.

Member Avatar for lmytilin
0
139
Member Avatar for trickx

You have one loop counting up. Add another one that counts down (the reverse of your counting up loop) before printing the newline.

Member Avatar for subtracktor
0
134
Member Avatar for Hardcoded

[QUOTE]I can't help but think data binding seems unnecessarily complicated...[/QUOTE] Implement equivalent behavior manually a few times and you'll begin to see how data binding makes life simpler. Of course, there's quite a learning curve in my experience, because binding can create frustratingly difficult to fix bugs. But once you …

Member Avatar for Hardcoded
0
182
Member Avatar for empror9

[QUOTE]up up[/QUOTE] Bummer. I was going to help you until I saw this bump. How arrogant and presumptuous. Bye bye.

Member Avatar for empror9
0
112
Member Avatar for MarounMaroun

[QUOTE]what is the (char **) before the &str1 and &str2?[/QUOTE] It's an unnecessary type cast. You're forcing &str1 and &str2 into the type between parens (a type that they already have).

Member Avatar for Narue
0
141
Member Avatar for Salamu

The member function you're trying to use is called is_open, not open.

Member Avatar for Clinton Portis
0
136
Member Avatar for plasticfood

You probably want to compare i against 12 rather than floorNum: [code] #include <iostream> int main() { for (int i = 0; i < 20; i++) { if (i == 12) continue; std::cout<< i <<'\n'; } } [/code]

Member Avatar for plasticfood
0
88
Member Avatar for Kosithc

Pointers to member functions and pointers to void are not compatible types. Figure out another solution that doesn't require this conversion.

Member Avatar for Narue
0
151
Member Avatar for sethwb
Member Avatar for electrox73

I'm not sure why you thought you could fail to close a string with a double quote, then start a new string and the compiler would somehow know to concatenate them. As long as there's nothing but whitespace between two string literals you can get that effect, but the strings …

Member Avatar for electrox73
0
703
Member Avatar for simply_viks

[QUOTE]sizeof(pste_msg) is giving 64[/QUOTE] Yes, because that's the size of the array. You're making a distinction between the memory capacity and the functional size. The capacity is how many items could possibly be stored in the array, while the functional size is how full the array is in terms of …

Member Avatar for hillstone_softw
0
187
Member Avatar for chintan_1671

[QUOTE]Sorry I didn't understood your reply.[/QUOTE] I didn't get the connection either. In your case you need to build the value byte by byte, which initially suggests bitwise operations, but there's a BitConverter class that will do what you want (unless you want something strange): [code] using System; namespace Project1 …

Member Avatar for ddanbe
0
239
Member Avatar for dinesh.isuranga

Provided the table has a primary key, you can easily generate the SQL to update with a SqlCommandBuilder and actually do the updates with a SqlDataAdapter: [code] using (var cmd = new SqlCommand(selectQuery, connection)) { using (var da = new SqlDataAdapter(cmd)) { using (var cb = new SqlCommandBuilder(da)) da.Update(table); } …

Member Avatar for dinesh.isuranga
0
5K
Member Avatar for shanki himanshu

[QUOTE]can u tell me the functions which is to be used.[/QUOTE] It's not that easy. There aren't any standard functions for processing image formats. You need to use a third party library or manually process the [URL="http://www.wotsit.org/list.asp?search=jpg&button=GO!"]file format[/URL].

Member Avatar for Narue
0
74
Member Avatar for localp

[QUOTE]is this statement correct?[/QUOTE] Nope, but there are caveats. You can't directly access C++-specific features without wrapping them in a C-compatible interface. This is done with the extern "C" construct to force C linkage and disable name mangling: [code] extern "C" void c_send_key(const char *key) { // ... } [/code] …

Member Avatar for Narue
0
805
Member Avatar for thelostboy
Member Avatar for gerard4143

[QUOTE]I can't find any mention of what happens to that object after the exception is finished[/QUOTE] Finished by being caught and handled, or finished by being unhandled? In the former case, the destructor is properly called and the object ends after the final exception handler completes. In the latter case, …

Member Avatar for gerard4143
0
129
Member Avatar for lulzy

It takes a little thought in designing your base class for polymorphism. Without any clue as to the data you're working with, I'd start with something like this: [code] class base { public: virtual data_type value() const = 0; int compare(const base& lhs, const base& rhs) { if (lhs.value() == …

Member Avatar for Red Goose
0
218
Member Avatar for lionconqueror

Did you hit your head and get amnesia or something? I answered all parts of this exact question in the only other thread you've posted on Daniweb.

Member Avatar for lionconqueror
0
100
Member Avatar for divyakrishnan

[QUOTE]I want to encrypt and decrypt a password using c#.net.[/QUOTE] Don't encrypt your passwords. You should use a method that isn't reversible, which is why cryptographically secure one-way hashing is a common practice. Add a salt to the password (so identical passwords don't produce the same hash), then hash the …

Member Avatar for AlBars
0
1K
Member Avatar for Crutoy

Your solution is fine, though if you fine yourself naming variables 1, 2, 3, etc., you really want an array instead: [code] #include <iostream> using namespace std; int main() { int iCouner, iNum[5], iRev = 0; int iWhole = 12321; for (iCouner = 10000; iCouner >= 1; iCouner /= 10) …

Member Avatar for frogboy77
0
117
Member Avatar for Lord_Migit

[B]>DNA Mate = *(testDNA.CrossoverMutate(testDNA2));[/B] The copy constructor will be called here to initialize Mate with the dereferenced pointer. If you don't want that happening, make Mate a pointer as well: [code] DNA *Mate = testDNA.CrossoverMutate(testDNA2); [/code]

Member Avatar for Lord_Migit
0
184
Member Avatar for divineelite

[QUOTE]The void* data = tail->data; isn't working.[/QUOTE] What do you mean by "isn't working"? The code you posted clearly isn't your actual code, so I can't say for sure what the problem is.

Member Avatar for divineelite
0
185
Member Avatar for itsvineet
Member Avatar for Sahil12354

Why in the world do you need to create a TSR? Those are about twenty years obsolete, and pretty much only usable on a true DOS system.

Member Avatar for Sahil12354
0
133
Member Avatar for dip7

Unless you need something special, it would be easier to convert the bits to a string and do string searches. Then the problem is trivial.

Member Avatar for Narue
0
104
Member Avatar for Arbus
Member Avatar for asterix15

[QUOTE]if so then why is the return type named int instead of char?[/QUOTE] For the same reason the parameter type is int instead of char, and why getchar returns int: to support EOF. If EOF were representable by char, how would you know the difference between EOF and a legitimate …

Member Avatar for anirudh33
0
133
Member Avatar for james6754

count is reinitialized to 0 with every iteration of the loop, so any changes you make to it will be lost on the next iteration.

Member Avatar for james6754
0
128
Member Avatar for moroccanplaya
Member Avatar for MasterGberry

[QUOTE]ref class does not have a user-defined copy constructor[/QUOTE] I bet you're using stack semantics with a copy constructor expecting managed references: [code] using namespace System; ref class example { public: example() { Console::WriteLine("Default constructor"); } example(const example^ ref) { Console::WriteLine("Reference copy contructor"); } }; int main(array<String ^> ^args) { …

Member Avatar for MasterGberry
0
1K

The End.