1,247 Posted Topics

Member Avatar for sjcomp

This has been a well known microsoft c++ (vc7/vc8) compiler bug; the compiler is picking up the wrong template specialization. It is harmless in this particular case (as well as all the other reported cases). the code is only instantiated, but not executed. (he specialization is only used in a …

Member Avatar for sjcomp
0
246
Member Avatar for blcase

[code]class Movie{ private: string director,title,genre; public: Movie(){ director="";title="";genre="";} [COLOR="Red"]};[/COLOR] int main(){ Movie a();}[/code]

Member Avatar for Narue
0
2K
Member Avatar for shadowfire36

> cant i just use visual studio from the command line ? [url]http://msdn2.microsoft.com/en-us/library/f35ctcxw(VS.80).aspx[/url] [url]http://msdn2.microsoft.com/en-us/library/dd9y37ha(VS.80).aspx[/url]

Member Avatar for WaltP
0
958
Member Avatar for superjacent

[code=c++]Move Move::add( const Move &m ) const { return Move( x + m.x, y + m.y ) ; }[/code]

Member Avatar for superjacent
0
206
Member Avatar for tonyaim83

[code=c++].... string CityName; string StreetName; GetName(CityName,StreetName); typedef vector<string> StrName; map<string,StrName>cityMap; map<string,StreetName>::iterator iterMap; cityMap[ CityName ].push_back( StreetName ) ; [/code]

Member Avatar for vijayan121
0
101
Member Avatar for gcardonav

in[code]throw [B]expression[/B] ;[/code] a. the (static) type of [B]expression[/B] cannot be an incomplete type. b. the static type of the [B]expression[/B] is used to initialize a temporary object of that type (through the type's copy-constructor) into a special memory location which must stay valid during the subsequent stack unwinding. (the …

Member Avatar for vijayan121
0
141
Member Avatar for kux

[code=c++]struct A { A( int i ) throw(char,int,double) : value(i) {} int value ; }; struct B : A { B() throw(char,int,double) ; }; B::B() throw(char,int,double) : A(20) {}[/code]

Member Avatar for kux
0
159
Member Avatar for shaikh_mshariq

if your program is console based (no gui), you could use telnet. server versions of windows ship with a telnet server. all current versions of windows ship with a telnet client. see [url]http://technet2.microsoft.com/windowsserver/en/library/ddf8b035-9035-475c-ae50-1d97bde83dba1033.mspx[/url] you could also use several third party telnet server programs. eg. [url]http://www.kpym.com/en/Overview.htm[/url] putty is a very poular …

Member Avatar for shaikh_mshariq
0
274
Member Avatar for jan1024188

[code=cplusplus] ostringstream stm ; stm << "Total points " << points ; MessageBox(hwnd, "You have bla bla", stm.str().c_str(), MB_OK); [/code]

Member Avatar for Aia
0
129
Member Avatar for jimmy.rocks1

> i want the output to be added to the existing lines in the text file > i actually used a fstream and manipulated by going to end of file by using seekg to get > to the end and it actually worked.. you must be using a fairly old …

Member Avatar for vijayan121
0
108
Member Avatar for carnage

> is there an escape sequence that lets me divide this long single line into multiple lines no escape sequence is required. a literal string can span multiple line (with quotes). [code] const char long_cstr[] = "this is the first line\n" "and this is the second line\n" "and you could …

Member Avatar for Narue
-1
2K
Member Avatar for lookin2know

> Create a function template called average(). It will accept two arguments of the same type and > computes the arithmetic average, returning a double. returning a double? [B]a.[/B] what should be the average of two complex numbers? a double or a complex? [B]b.[/B] what should be the average of …

Member Avatar for vijayan121
0
191
Member Avatar for GSTARRAW

> And my CPU occuption rate is high while at runtime as well the memory. yes, using just backtracking alone can get computationally horrendous. Warnsdorff's algorithm (goal programming) is easy to program and is very efficient. (does not work for very large boards). [quote]Backtracking algorithms (in which the knight is …

Member Avatar for vijayan121
0
156
Member Avatar for Aashath

FileSystemWatcher (in CLR) uses the win32 api functions [B]FindFirstChangeNotification [/B] and [B]FindNextChangeNotification[/B] [url]http://msdn2.microsoft.com/en-us/library/aa364417.aspx[/url] along with a wait function to get notifications of changes. to retrieve information about the changes, you coud use [B]ReadDirectoryChangesW[/B] [url]http://msdn2.microsoft.com/en-us/library/aa365465(VS.85).aspx[/url]

Member Avatar for vijayan121
0
166
Member Avatar for programmingme

> If everything is declared the same - as double - how do I make the parameters different? don't declare everything the same; create different types your code will also be more typesafe. [code=cplusplus]#include <iostream> struct temperature { double value ; inline temperature( double t ) : value(t) {} inline …

Member Avatar for JRM
0
279
Member Avatar for loushou

> .. obviously not writing in binary out mode because this is just text [B]ios_base::binary[/B] only disables the control sequence translations ( for '\n', '\r' etc.) that take place during formatted input or output. to write raw binary data to a file, you will have to use unformatted output functions. …

Member Avatar for Duoas
0
100
Member Avatar for vanalex

> The array of course instances confuses me... there is nothing to get confused about; a c-style array of course instances cannot be created at all. reason: course does not have a [B]default[/B] constructor.

Member Avatar for rkavinash
0
112
Member Avatar for Narue

using boost.assign [URL]http://www.boost.org/libs/assign/doc/index.html[/URL] is the easiest way to fill containers; and it also works with containers other than vector<>. [code=cplusplus]#include <vector> #include <list> #include <map> #include <string> #include <boost/assign.hpp> using namespace std; using namespace boost::assign; int main() { vector<string> strings = list_of("abcd")("efg").repeat(5,"hi")("jkl") ; // "abcd" "efg" "hi" "hi" "hi" "hi" …

Member Avatar for bector
2
8K
Member Avatar for hashinclude

> but when i copy that executable file to another computer and try to run it i get an error > that says "application failed to start because application configuration is incorrect". you also need to copy the manifest file created when linking the application. (the manifest file contains information …

Member Avatar for iamthwee
0
162
Member Avatar for phalaris_trip

here are a few observations for starters. a. your assignment operator does not take care of self-assignment. try running [code=c++]// ... void do_assign( String& a, const String& b ) { a = b ; } int main() { String str( "hello world" ) ; do_assign( str, str ) ; }[/code] …

Member Avatar for phalaris_trip
0
88
Member Avatar for vikasmailsu

this is the first result returned by a google search [url]http://oedbx.aroh.de/[/url]

Member Avatar for vikasmailsu
0
206
Member Avatar for swethakiran

a #import directive like [B]#import "<name of the ocx file or typelibrary>" no_namespace, raw_interfaces_only \ named_guids raw_native_types <any other #import attributes>[/B] will generate a header file with the name [B]<base name of tlb/ocx>.tlh[/B]. and this header is impliciltly #included. the #import attributes specify options for generating the header file. this …

Member Avatar for swethakiran
0
4K
Member Avatar for pepipox

the code in the [B]if-else[/B] is equivalent to [code] if(ARG::metrn==metrnSMD) { EventStream<complex<Lambda>> evstrTrain(fileTrain, evlsTrain); } else { EventStream<Lambda> evstrTrain(fileTrain, evlsTrain); } [/code] so the variable is not visible outside the scope of the [B]if[/B] or [B]else[/B] blocks. one commonly used work around is to have a polymorphic base class. this …

Member Avatar for pepipox
0
153
Member Avatar for octavia

> Error mentioned that my program requires a reinterpret_cast , a c_style cast or function_style cast.** the code you posted does not give that particular error. the two errors in your code are a. [icode]#include <iostream.h>[/icode] is not standard c++. replace this with [icode] #include <iostream>[/icode] and [icode]using namespace std;[/icode] …

Member Avatar for vijayan121
0
292
Member Avatar for eranga262154

change [B]cout << os ;[/B] to [B]cout << os.str() ;[/B] [B]os.str()[/B] gets the [B]string[/B] from the stringstream. [B]cout << os ;[/B] is equivalent to [B]cout << (const void*)os ;[/B] prints the pointer value.

Member Avatar for eranga262154
0
139
Member Avatar for Deadvacahead

for things of this kind, using a scripting language like perl would be much easier than programming it in c++. [code=cplusplus]#include <iostream> #include <fstream> #include <string> #include <vector> #include <locale> using namespace std; const string choice_letters = "abcde" ; const string answer_prefix = "ANS:" ; inline bool is_choice( const string& …

Member Avatar for n.aggel
0
157
Member Avatar for jaux

see: More Effective C++: 35 More Ways to Improve Your Programs and Designs (Scott Meyers) ITEM 27. Requiring or Prohibiting Heap-Based Objects. and [url]http://www.aristeia.com/BookErrata/M27Comments_frames.html[/url]

Member Avatar for jaux
0
120
Member Avatar for Underdog67

read in as a char and check if it is 'H' or 'S'; set the enum accordingly. [CODE] PayType pt ; char c ; infile >> c ; if( c == 'H' ) pt = H ; else if( c == 'S' ) pt = S ; else infile.setstate( std::ios::failbit …

Member Avatar for iamthwee
0
117
Member Avatar for jaepi

this article should contain all the information that you need: [url]http://www.ddj.com/cpp/184403638;jsessionid=S0L5ADAGUG4VKQSNDLRSKH0CJUNN2JVN?pgno=4[/url] take note of the date it was written; the references to Microsoft C++ are to the now obsolete VC++ 6.0 and not to the current 8.0 version, which has a complete rewrite of the standard c++ library (based on …

Member Avatar for jaepi
0
148
Member Avatar for jaepi

check this library out. [url]http://code.jellycan.com/simpleini/[/url] i've not used it; but the reports that i've come across are good. and the license is non-viral (MIT)

Member Avatar for jaepi
0
1K
Member Avatar for wijitha

see [url]http://www.informit.com/articles/article.aspx?p=169524&seqNum=8&rl=1[/url] googling would get you many more such links.

Member Avatar for Ancient Dragon
0
175
Member Avatar for FireSBurnsmuP

if the iterator is a [B]random_access[/B] iterator [B]one + 1[/B] is supported. if not, you could write [CODE]for( iterator_type one ; /*...*/) { iterator_type two = one ; for( ++two ; /*...*/) { /*...*/ } }[/CODE] if you want to figure out what kind of iterator it is, use [B]std::iterator_traits<>[/B]. …

Member Avatar for vijayan121
0
140
Member Avatar for FireSBurnsmuP

mostUsed is a const. use a const_iterator. also a prefix increment instead of a postfix (efficiency) [code]for ( map<string,int>::[COLOR="Red"]const[/COLOR]_iterator word = mostUsed.begin() ; word != mostUsed.end() ; [COLOR="Red"]++[/COLOR]word ) { /*...*/[/code]

Member Avatar for FireSBurnsmuP
0
447
Member Avatar for tootypegs

you must assign static ip addresses to the two machines from one of these three non-routing address pools [B] 192.168.0.0[/B] to [B]192.168.255.255[/B] [B]172.16.0.0[/B] to [B]172.31.255.255[/B] [B]10.0.0.0[/B] to [B]10.255.255.255[/B] see [url]http://www.faqs.org/rfcs/rfc1918.html[/url] once you have done that, use any file transfer mechanism that catches your fancy; FTP, sockets programming, NFS or whatever …

Member Avatar for vijayan121
0
74
Member Avatar for kv79

see [url]http://msdn2.microsoft.com/en-us/library/aa489518.aspx[/url] and [url]http://msdn2.microsoft.com/en-us/library/ms801998.aspx[/url]

Member Avatar for Salem
0
162
Member Avatar for BlackNinja

[code=c++]#include <sstream> #include <string> #include <iostream> template< typename T > inline std::string to_string( const T& v ) { std::ostringstream stm ; return (stm << v) ? stm.str() : "error" ; } int main() { double value = 1.2345 ; std::string str_value = to_string(value) ; // c++0x // std::string str_value = …

Member Avatar for vijayan121
0
72
Member Avatar for mannantes

use [B]std::sort[/B] with a predicate. [url]http://www.codeguru.com/forum/showthread.php?t=366064[/url] [url]http://www.codeproject.com/vcpp/stl/functor.asp?df=100&forumid=2645&exp=0&select=1791095[/url]

Member Avatar for mannantes
0
82
Member Avatar for dallaseve

> getting managed code to talk to unmanaged code? the easy way is to just mix the managed and unmanaged code as required. this is called IJW ( "it just works" ). using p-invoke is only slightly harder. [code=c++]#include "stdafx.h" #include <iostream> #include <algorithm> #include <iterator> using namespace System; using …

Member Avatar for dallaseve
0
127
Member Avatar for johnnyjohn20

> you should have posted this in the C forum. There is nothing specific to C++ in this thread. do you really mean [CODE]namespace { int foobar( int i ) { return ++i ; } }[/CODE] is c++, but if you place the same function in the global namespace, it …

Member Avatar for vijayan121
0
108
Member Avatar for mikeandike22

> This should have never compiled in gcc ... true, it should never compile without errors in any c++ compiler. but g++ does accept it without specific switches that turn on C++ compliance. eg. [B]> g++ --std=c++98 --pedantic -c whatever.cc [/B] or [B]> g++ --ansi --pedantic -c whatever.cc [/B] would …

Member Avatar for Nick Evan
0
281
Member Avatar for bilalb1

you could use a std::set< std::string > ( or a map or a hashmap as you suggested ) to check for the duplicates. see this thread: [url]http://www.daniweb.com/forums/thread81348.html[/url]

Member Avatar for bilalb1
0
741
Member Avatar for malathuis

something like this perhaps? [code=c++]#include <iostream> inline int larger( int a, int b ) { return a>b ? a : b ; } inline int smaller( int a, int b ) { return a<b ? a : b ; } int main() { int number ; std::cin >> number ; …

Member Avatar for malathuis
0
124
Member Avatar for johnpmii

[CODE]// istream file, string str1, str2, str3 // read to the first colon assert( geline( file, str1, ':' ) ) ; // get first letter after the first colon assert( geline( file, str2, ':' ) && !str2.empty() ) ; char c = str2[0] ; // read all the letters after …

Member Avatar for Duoas
0
161
Member Avatar for fudawala

[code]for (k = 0; k < MAXNUMS; k++) // Display and calculate the voltage { cout << "The voltage is " << volts[k] << endl; volts[k] = current[i] * resistance[j]; }[/code] not 'Display and calculate the voltage' but 'calculate first and then display the voltage' swap the two lines in …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for tootypegs

[B]DefineDosDevice[/B] (with DDD_RAW_TARGET_PATH flag) could be used to create a junction in the object namespace; the junction can then be used as a dos path string. [url]http://msdn2.microsoft.com/en-us/library/aa363904.aspx[/url] if the device already has a dos name, [B]QueryDosDevice[/B] can be used to get information about dos device names. [url]http://msdn2.microsoft.com/en-us/library/aa365461.aspx[/url]

Member Avatar for tootypegs
0
104
Member Avatar for krnekhelesh

you still use RegQueryValueEx. [CODE]LONG WINAPI RegQueryValueEx( HKEY hKey, LPCTSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, // will be set to the type of data // (eg. REG_BINARY if value was binary) LPBYTE lpData, LPDWORD lpcbData );[/CODE] see [url]http://msdn2.microsoft.com/en-us/library/ms724884.aspx[/url] for the registry value types.

Member Avatar for vijayan121
0
1K
Member Avatar for ishwarbg

the pointer returned by [B]string::c_str()[/B] is a. a [B]const char*[/B]. if you need a[B] LPSTR[/B] ([B]char*[/B]), you need to copy ([B]strcpy[/B]) it to an array of chars b. usable as a [B]LPCSTR[/B] ([B]const char*[/B]) only as long as you have not modified the string. you need to make your own …

Member Avatar for vijayan121
0
2K
Member Avatar for boyz

> but how would u carry out this operation??? a= 10 + b; // it's not (b+10) >> the problem you are facing can be eliminated by using friend functions. [B]friend[/B] functions are functions which are not members of the class, but are granted the same access rights as members …

Member Avatar for vijayan121
0
105
Member Avatar for jaepi

if you do not mind the viral license, you could use this. [url]http://www.matteolucarelli.net/libreria/GetPrivateProfile/GetPrivateProfile.c.htm[/url] after sanitizing it by removing things like calls to [B]atoi[/B].

Member Avatar for vijayan121
0
166
Member Avatar for wijitha

there are many simple tutorials available on the net. like this one [url]http://www.huihoo.org/ace_tao/ACE-5.2+TAO-1.2/ACE_wrappers/docs/tutorials/online-tutorials.html[/url]

Member Avatar for vijayan121
0
289

The End.