Posts
 
Reputation
Joined
Last Seen
Ranked #1K
Strength to Increase Rep
+6
Strength to Decrease Rep
-1
100% Quality Score
Upvotes Received
32
Posts with Upvotes
26
Upvoting Members
7
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
8 Commented Posts
0 Endorsements
Ranked #818
~45.0K People Reached
About Me

Datta, Dayadhvam, Damyata

non quasi imperans dico sed per aliorum sollicitudinem etiam vestrae caritatis ingenitum bonum conprobans

Favorite Forums
Favorite Tags
c++ x 51
c x 14

56 Posted Topics

Member Avatar for linq

Make sure you created a Win32 project and not a console project (how to do that depends on your IDE)

Member Avatar for NathanOliver
2
196
Member Avatar for Eddy Dean

You shouldn't have to bother with all that, since InternetOpenUrl expects LPCTSTR (typedef as const TCHAR*) as its second argument. Try: [code] hFile = InternetOpenUrl( hINet, sUrl.c_str(), NULL, 0, 0, 0 ); [/code]

Member Avatar for Salem
0
2K
Member Avatar for nhandal

Well, it seems likely the problem is in one of the two parameters you pass to the LoadBitmap function. You should check the return value of GetLastError after LoadBitmap fails, and look it up [url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes.asp]here[/url].

Member Avatar for lashatt2
1
428
Member Avatar for FireSBurnsmuP

Do you mean the length of a c-style string (char array) or the length of a std::string? You could use strlen for the former, and the length() member function for the latter

Member Avatar for geinjo
0
2K
Member Avatar for noxee

[code] string input; while (!ifile.eof()) { getline(ifile,input); cout << input << endl; } [COLOR=red] ifile.seekg(0,std::ios::beg); //reset read pos to beginning ifile.clear(); //clear eofbit [/COLOR] while (!ifile.eof()) { ifile.get(ch); cout << ch; } [/code]

Member Avatar for Ayu1004
0
304
Member Avatar for ArNy

A major difference that hasn't been noted (unless I just missed it) is that 2005 uses C++/CLI for .NET programming, whereas 2003 uses the older managed extensions for C++. Just to clarify, C++/CLI is essentially its own language, though it is based on C++. Also, all the express versions are …

Member Avatar for lwxmeme
0
498
Member Avatar for virus.exe

[quote=~s.o.s~;333350]> In C. It's not a good idea to use that in C++, use cin.get() instead. Any good reason to back that up ? ;)[/quote] According to the standard, the c header files are deprecated, meaning they might be removed from the standard in future revisions.

Member Avatar for WaltP
0
2K
Member Avatar for NSta

[code] Entry *entry; entry = [COLOR=#0000ff]new[/COLOR] Entry(media, entertainment); [/code] What are you trying to do here? You've already assigned the private members of the class (_media and _entertainment). And once the function returns, the newly allocated Entry object is lost (memory leak)

Member Avatar for NSta
0
130
Member Avatar for disc

In addition, you may want to search for "functor" or "function object" for more information.

Member Avatar for disc
0
166
Member Avatar for venomlash

It's not an "abnormality," it's actually part of the C++ standard. As I understand it, operators like 'and' and 'or' are included for users with different character sets. See: [URL]http://david.tribble.com/text/cdiffs.htm#C99-alt-tok[/URL] Microsoft compilers appear to implement these as macros instead of keywords in the ciso646 header. As for the second part …

Member Avatar for vegaseat
0
202
Member Avatar for kararu

Could you post a short program that demonstrates the problem (and that we can actually compile)?

Member Avatar for kararu
0
249
Member Avatar for DmD

Since it appears you are using managed (.NET) code, why not use the .NET classes for file IO? I'm no expert at C++/CLI but it might be as simple as: [code] System::IO::StreamWriter^ sw = gcnew StreamWriter("file.txt"); sw->WriteLine(txt1->Text); [/code]

Member Avatar for Nick Evan
0
1K
Member Avatar for lalalu

The first part looks ok to me, but for the second part you also need to allocate space for each pointer in the array

Member Avatar for lalalu
0
989
Member Avatar for Clinton Portis

If you're going to use std::find like that, you need to define an equality operator for your info class: [code] class Info { public: bool operator==(const std::string& first_name); //... } [/code] However, you may want to use std::find_if instead. find_if allows you to specify an unary predicate as the matching …

Member Avatar for iamthwee
0
127
Member Avatar for doraemon

What do you expect to happen? After you increment 'p' in your third loop, it points past the last element of the array, so you're bound to get garbage data on your last outputs.

Member Avatar for rowly
0
148
Member Avatar for phuduz

Try indenting/using code tags (some IDEs can even indent for you!): [code] #include <iostream> #include <string> #include <iomanip> using namespace std; int main() { // Declare Variables int withdraw; string name; double acctbalance, deposit; char choices; acctbalance = 0; //inputs, get the name and initial balance cout << "Enter Name: …

Member Avatar for ~s.o.s~
0
102
Member Avatar for mikeallen

hand appears to be a 2-dimensional array, in which case you need to compare each element (if you use only one subscript, you're comparing a pointer to an integer) [code] if (hand[i][0]==1 && hand[i][1]==2 && /*...*/) [/code] Of course, the problem here is that the cards may not be in …

Member Avatar for bumsfeld
0
115
Member Avatar for matrimforever

Is that table correct? I would think that you should start with two rabbits, then the number should double each month (i.e., exponential growth of 2^x)

Member Avatar for matrimforever
0
372
Member Avatar for zith7400

Any particulary reason you're writing procedural code in C++? A better approach would be to create a tree class that handles everything. Anyways, one major problem you have is that you pass a single pointer to traverse. The pointer in traverse is local to the function, so setting [inlinecode] current …

Member Avatar for ~s.o.s~
0
269
Member Avatar for nanodano

Your code shouldn't even compile. You're missing a using declaration (I assume) and main should return 'int' Also, you should use std::stringstream instead of strstream (I believe the latter is deprecated)

Member Avatar for nanodano
0
130
Member Avatar for hoosier23

[quote=hoosier23;258055] What is the logic behind using float SavingsAccount::annualInterestRate = 0; right before my main? I see that you are setting annualInterestRate to zero, but why does this need to be done? Afterall, I have made annualInterestRate .03 in the default constructor. [/quote] I believe static variables will be automatically …

Member Avatar for Salem
1
189
Member Avatar for Killer_Typo

Look at [URL="http://www.cplusplus.com/ref/iostream/ifstream/"]std::ifstream[/URL]. E.g.: [code] #include <fstream> #include <string> //... std::ifstream infile("somefile"); if (!infile.good()) { //failed to open } std::string line; std::getline(line,infile); //read a line into std::string [/code]

Member Avatar for Killer_Typo
1
388
Member Avatar for hoosier23

Looks like a decent start. You just need to find a way to get the correct subscript into 'deck' to assign values in the inner loop, and then figure out how to shuffle the deck. The simplest way to do the last part is probably std::random_shuffle. You might also consider …

Member Avatar for iamthwee
1
125
Member Avatar for MrLew

How exactly are you linking this? I see you have two entry points (in pointTypeImp.cpp and circleTypeImp.cpp) and circleTypeImp.cpp relies on code from pointTypeImp.cpp. Obviously, though, you aren't linking these two files or you would have a multiple definition error for main. Generally, you should have separate files that contain …

Member Avatar for MrLew
1
208
Member Avatar for amano

> One more thing, if i can't call main() recursively, can u suggest me any other way to call the main just after finish other function. You don't need to call main; when your function finishes, it returns the calling function. If you need the code to repeat, use a …

Member Avatar for Dave Sinkula
0
1K
Member Avatar for Flay

Maybe there's a problem with your compiler/IDE installation or with the header files. Also, make sure your code is being compiled as C++ and not C

Member Avatar for GloriousEremite
1
280
Member Avatar for Marthy
Member Avatar for linq

Some more info can be found here: [URL]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_data_types.asp[/URL] Namely, it says that WINAPI and CALLBACK are both defined as __stdcall (it might not help you much, but [URL="http://msdn2.microsoft.com/en-us/library/984x0h58.aspx"]this[/URL] explains different MS specific calling conventions)

Member Avatar for GloriousEremite
0
414
Member Avatar for nhandal

Could you post a short example program that we can compile, and that demonstrates the problem?

Member Avatar for nhandal
1
105
Member Avatar for linq

Try pressing alt-tab. It might appear elsewhere as well, but I can't think of where at the moment.

Member Avatar for GloriousEremite
1
95
Member Avatar for bobeagle

> with a return 0 at the end of the program, as defined by the C++ Standard. Actually, return 0 is implicit for main() if a return statement is omitted. It's probably still good practice to explicitly return something, however.

Member Avatar for GloriousEremite
1
161
Member Avatar for Daijing

open expects a c-style string. You can use the c_str() std::string member function: [code] InObj.open(fname.c_str()); [/code]

Member Avatar for ~s.o.s~
1
194
Member Avatar for LieAfterLie

You might be able to use a pointer instead. E.g.: [code] [COLOR=#0000ff]#include[/COLOR][COLOR=#000000] <iostream>[/COLOR] [COLOR=#000000]const int ARRAY_SIZE = 5;[/COLOR] [COLOR=#0000ff]int[/COLOR][COLOR=#000000] array1[] = {1,2,3,4,5};[/COLOR] [COLOR=#0000ff]int[/COLOR][COLOR=#000000] array2[] = {6,7,8,9,10};[/COLOR] [COLOR=#0000ff]int[/COLOR][COLOR=#000000]* arrays[] = { array1, array2 };[/COLOR] [COLOR=#0000ff]int[/COLOR][COLOR=#000000] main()[/COLOR] { [COLOR=#0000ff]int[/COLOR] idx; std::cout<<"Enter index: "; std::cin>>idx; [COLOR=#0000ff]for[/COLOR] ([COLOR=#0000ff]int[/COLOR] i=0;i<ARRAY_SIZE;i++) std::cout<<arrays[idx][i]; } [/code] Note that …

Member Avatar for WolfPack
1
910
Member Avatar for SHWOO

MailCarrier's default constructor tries to implicitly call the base class (Employee) constructor. You need to either define a constructor for Employee that takes no arguments, or explicitly call the constructor that you do have in MailCarrier's default constructor initializer list.

Member Avatar for GloriousEremite
0
849
Member Avatar for V1RuZ

'person' is a map of maps, not a Person_class, so naturally it won't have those members. person["somestring"]["somestring"] would return (or set) a Person_class, however, so trying: [code] person[person.get_surname()][person.get_name()].begin() [/code] Wouldn't make sense (Person_class doesn't have a begin() method). I suppose you could do (untested): [code] for (i = person.begin(); i …

Member Avatar for V1RuZ
0
729
Member Avatar for ishwar

Use the strstr function perhaps? I'm assuming you're using C, because you'd be better of using the std::string class and substr functions if you're using C++.

Member Avatar for ishwar
0
22K
Member Avatar for DotNetUser

What do you mean by "doesn't like it"? Could you post some example code?

Member Avatar for GloriousEremite
0
94
Member Avatar for Eddy Dean

Have you actually looked through your code, line by line (possibly while debugging)? How about these lines, in the encryption function: [code] [COLOR=#008000]// put length back in the package [/COLOR] (*outbuf)[0] = newsize & 0xFF; (*outbuf)[1] = (newsize >> 8) & 0xFF; [/code] You seem to completely ignore that the …

Member Avatar for Eddy Dean
0
1K
Member Avatar for DotNetUser

You probably either need to make the function non-static or the member data static. There is no way to access non-static data from a static member function without an instance of the class to operate on.

Member Avatar for DotNetUser
0
99
Member Avatar for ammu117

[quote] * Turbo C++ -- very old 16 bit compiler. Works, but so does mouldy cheese. * Dev C++ -- up to date 32 bit compiler [/quote] Borland is actually bringing back their turbo products ([URL="http://www.borland.com/us/company/news/press_releases/2006/08_08_06_borlands_developer_tools_group_announes_plans.html"]link[/URL]), but for now I guess we can still scold people for using turbo And …

Member Avatar for Grunt
0
139
Member Avatar for puuukeey

[code] [LEFT]void ReadLine( char *line ) // line is a string { while ( (*line = getchar() ) != '\n' ) line++; *line = 0; } [/code] This is a buffer overflow waiting to happen. What happens if someone passes an array of some arbitrary size, say 50 bytes, and …

Member Avatar for Dave Sinkula
0
155
Member Avatar for costantinos
Member Avatar for Gunner54

> BTW Im English I Dont Use Those Words For Those Sigh's In English Here. Really? What words do you use? I have never heard them referred to by any other name. > that takes time and money the ony thing i didnt understand was words... You do know how …

Member Avatar for Dave Sinkula
0
582
Member Avatar for RFBourquin

Of course, if you're compiling with UNICODE defined, you'll have problems. You could probably do something like: [code] [COLOR=#0000ff]namespace[/COLOR][COLOR=#000000] MyProg[/COLOR] { [COLOR=#0000ff]typedef[/COLOR] std::basic_string<TCHAR> string; } //... MyProg::string str(TEXT("Hello world")); [/code] This would compile with or without UNICODE defined.

Member Avatar for GloriousEremite
0
151
Member Avatar for cgerber

> as if the list needs initialization. I'd say that's dead on. If you use malloc the list's constructor isn't going to be called. Since this is C++ you should be using new/delete. You should also avoid using naked pointers most of the time, in favor of smart pointers like …

Member Avatar for WaltP
0
106
Member Avatar for Daan
Member Avatar for abujunad

Do you know how to write a function? Surely your book/tutorial/etc tells you how. If you can write a non-templated function (accepting integers as arguments, perhaps) it shouldn't be hard to make it templated.

Member Avatar for ~s.o.s~
0
92
Member Avatar for chethanasrao

Look into boost filesystem perhaps? I think it would satisfy those requirements (besides the xml file)

Member Avatar for Salem
0
89
Member Avatar for tefflox

[code] double pay = static_cast<double>(emp.hoursWorked) * emp.hourlyRate + OVERTIME_RATE * emp.hourlyRate * static_cast<double>(emp.hoursWorked - 40); [/code] A couple of problems. First, you're paying the employee for 41 hours at the normal rate [I]plus[/I] their overtime pay. This equals 41*10 + 1.5*10*1 = 425. Secondly, what happens if the worker works …

Member Avatar for tefflox
0
178
Member Avatar for Eddy Dean

For your linker errors, you need to link with wininet.lib. Also, I don't think InternetReadFile null-terminates the data, so take that into account.

Member Avatar for ~s.o.s~
0
922

The End.