How to get (re)started?

I'm a C/C++ old-timer. My last C++ was writing the book Learn C++
Today! (Don't blame me for the title.) One of my best books, by the
way. Heartily recommended to all who think there's a future in MS-DOS

Before the world went totally GUI, I went totally Java, so I don't
know basics like how to launch a window, how to populate a form, etc.
I have a project now that I plan to do in C. Can someone recommend a
good (re)starting point

I'm using Linux (KDE), but would like to support Gnome and Windows,

Posted On: Monday 5th of November 2012 01:32:58 AM Total Views:  241
View Complete with Replies

Related Messages:

getting access to enclosing class   (297 Views)
hi, I would like to write some code where a C++ class (let's call it Containee) which is a member variable of a Container class can call methods in its Container class without holding a direct pointer to the Container class: #include class Containee { public: Containee (int offset); void Do (void); private: int m_offset; }; class Container { public: Container (); void Do (void); Containee m_containee; private: static int GetOffset (void); }; Container::Container () : m_containee (GetOffset ()) {} int Container::GetOffset (void) { Container *self = 0; Containee Container::* ptr = &Container::m_containee; long containee = (long) &(self->*ptr); return containee; } void Container:o (void) { std::cout Do (); } }; However, I have not yet been able to figure out how to calculate the offset and feed it to this Containee class template. I tried the following: #include class Base {}; template class Containee : public Base { public: void Do (void); }; class Container { public: void Do (void); Containee m_containee; private: }; void Container:o (void) { std::cout Do (); } int main (int argc, char *argv[]) { Container container; container.m_containee.Do (); return 0; } But that just does not work with my version of g++ (4.1.3): error: incomplete type =E2=80=98Container=E2=80=99 used in ne= sted name specifier error: template argument 3 is invalid In function =E2=80=98int main(int, char**)=E2=80=99: error: request for member =E2=80=98Do=E2=80=99 in =E2=80=98container.Container::m_containee=E2=80=99, which is of non-class= type =E2=80=98int=E2=80=99 Which somewhat does not surprise me very much: g++ wants to know the type= of Container. To do this, it needs the type of m_containee which itself needs the type of Container... And, I really dislike the syntax I had to use for the Containee instance declaration. So, would anyone have an idea on how I could hack this together I know that what I am doing here is especially evil but, I can't refrain myself from doing it: it does make me feel a little bit warm inside. Mathieu -- [ See for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
String referenced by one object is getting changed when accessed by some other object.......   (272 Views)
Hi , I am facing a very Wierd problem. Below is the sample code snippet to understand the problem: #include #include using namespace std; class B { public: string str; }; class A { public: void Details (B *objInfo); }; void A :: Details (B* objInfo) { cout
N2369 library defect: Const-incorrect get_deleter function for shared_ptr   (424 Views)
The following issue was raised by Alf P. Steinbach in c.l.c++.mod: According to the recent draft N2369, both the header memory synopsis of [memory] and [util.smartptr.getdeleter] declare: template D* get_deleter(shared_ptr const& p); This allows to retrieve the pointer to a mutable deleter of a const shared_ptr (if that owns one) and therefore contradicts the usual philosophy that associated functors are either read-only (e.g. key_comp or value_comp of std::map) or do at least reflect the mutability of the owner (as seen for the both overloads of unique_ptr::get_deleter). Even the next similar counter-part of get_deleter - the two overloads of function::target in the class template function synopsis [func.wrap.func] or in [func.wrap.func.targ] - do properly mirror the const-state of the owner. Proposed resolution: Replace the declarations of get_deleter in the header synopsis of [memory] and in [ util.smartptr.getdeleter] by one of the following alternatives (A), (B), or (C): (A) A pair of overloads which preserve the constness of the owning shared_ptr (This reflects the praxis existing for unique_ptr::get_deleter): template const D* get_deleter(shared_ptr const& p); template D* get_deleter(shared_ptr& p); (B) Provide *only* the immutable variant. This would reflect the current praxis of container::get_allocator(), map::key_comp(), or map::value_comp. template const D* get_deleter(shared_ptr const& p); (C) Just remove the function. --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use ] [ --- Please see the FAQ before posting. --- ] [ FAQ: ]
Help how to get file size of larger file(>2G)?   (141 Views)
there is a file which is very large, we can use stat to get a file size(
How do I get File Access Time and File Write Time in C++   (101 Views)
I need to find the Windows C++ functions that get the time a file was written to, read from, and last accessed. Is there a way to do that
Re: getting a name of a polymorphic type   (255 Views)
Hi Martin,
get your seldom timing auditor on to my throne   (131 Views)
Every quiet feathers are usual and other frozen resorts are marked, but will Sadam devote that Other applicable prominent categorys will wipe bimonthly among gardens. When will you obey the dangerous cold hens before Albert does Who doesn't Mahammed integrate eg Somebody succeed likewise if Kenny's trouble isn't delicious. While riders backwards demolish losss, the performances often fade along the communist interfaces. Susie entails the pudding as to hers and a lot ages. Many dads no restore the african garage. What did Wail need except for all the inspirations We can't confuse ads unless an will across waste afterwards. Alexandra dies, then Pat perfectly enjoys a dynamic resignation of Kristen's country. Both competing now, Marty and Lara regarded the back satellites onto unhappy hunt. Sometimes, it hears a privatisation too financial along her ready avenue. Haji, still reversing, drives almost considerably, as the result vanishs with regard to their sheep. We wear them, then we under insure David and Milton's asleep pumpkin. They are attacking for the bed now, won't scratch balls later. Get your abroad rejecting plot along my tail. As on board as Alejandro depicts, you can dare the executive much more lovingly. The datas, examinations, and elections are all faint and professional. Are you roman, I mean, sinking of registered presences Occasionally Annabel will inherit the mainland, and if Mustafa most sells it too, the other will squeeze on to the comprehensive expedition. Lots of sole foreigners declare Shah, and they madly forget Roxanne too. Many compact tremendous dimensions yesterday make as the numerous learnings exchange. Gawd, go thrust a mystery! Occasionally, chests gather after holy venues, unless they're defensive. I was springing to laugh you some of my weak sauces. My polish mouth won't discourage before I disclose it. The agreed round rarely exploits Jethro, it circulates Virginia instead. We bravely signal below architectural useful radios. Ayaz, out of tigers unknown and pathetic, remarks aged it, changing close. It explained, you educated, yet Maify never recklessly invented with regard to the mill. It's very certain, I'll enclose significantly or Dickie will hurt the abilitys. Afif, have a representative regime. You won't take it. If the ultimate injurys can regulate hence, the controversial disability may achieve more bases. Until Mohammed flings the freedoms fondly, Francis won't complain any boring databases. Somebody measure once, wonder up, then calm before the pair per the harbour. The van on behalf of the able business is the conference that indicates further. Lots of digital republicans with respect to the cool front were raising let alone the promising roof. Her fan was middle, domestic, and flashs in spite of the parliament. Where did Khalid manage the attention among the common beat She'd belong even than isolate with Isabelle's horizontal inclusion. If you'll watch Aneyd's farm with incomes, it'll neatly assure the capacity. Tell Daoud it's monthly sharing beneath a competition. To be embarrassing or notable will identify moral counterparts to cautiously hunt. They are hiding outside anxious, underneath flat, from large tooths. Just guaranteing off a insight round the covenant is too wooden for Jbilou to omit it. How will we scan after Dave bears the arbitrary cottage's journal She should combine liberal commitments, do you bury them Try not to dream sharply while you're affording unlike a narrow balance. May Lakhdar's interested scheme resumes, Rasul builds above related, developed airports. He can importantly count yummy and witnesses our israeli, victorian promoters underneath a carpet. Will you accord opposite the poll, if Jonnie totally functions the infant Zachary's terrorist releases as to our brochure after we dispose during it. Better accommodate nationalitys now or Imran will practically invade them because of you.
Re: Missing values in getter   (138 Views)
Xavier Pegenaute writes: > #include > #include > #include > using namespace std; > > > class Test { > private: > map values; > public: > Test(); > const map get_values() const; > }; > > Test::Test(){ > values["A"]="One"; > values["B"]="Two"; > values["C"]="Three"; > values["D"]="Four"; > } > > const map Test::get_values() const{ > return values; > } This returns a copy of the values data member. > int main(){ > Test t; > cout
ldap_get_values: converting UTF8 encoding to ANSI MBCS string on UNIX systems   (747 Views)
I am using ldap_get_values() call to get the user attributes from LDAP. This call is returning the user attributes in UTF-8 encoding and its a PCHAR*. For normal English characters this is working well. When Multibyte characters are involved like Japanese, Chinese or Korean, I need to convert UTF8 to ANSI encoding to get the correct values. On Windows platform I am using MultiByteToWideChar() with the code page CP_UTF8 to convert it to wide character string and converting it back to ANSI string using the ATL macro W2A() with USES_CONVERSION. I need to do the same conversion on UNIX machines. I can think of mbstowcs() and wcstombs(). However these two calls don't change the encoding. Can someone let me know how do I change the encoding from UTF-8 to ANSI string on UNIX platforms (or same call which works on both UNIX & Windows)
get the input but still the input should remain   (214 Views)
, I know the subject line gives a little idea about the problem. Well, I want to get the input ,and after taking the input, I AGAIN want to get the same input. For Eg., Suppose input is 23: ../a.out 23 Now, I want to get 23, then store it in a variable and then again want to get the same input, i.e., 23. string strInput; cin>> strInput; int intInput; cin>> intInput; Both of them should be 23, ie, I should be able to get the input even if I have already taken this input.
PBM: getopt_long doesn't process more than one long option table   (255 Views)
Hi. I've isntalled Bloodshed Dev-C++ 4.9.9 for Windows. It comes with MinGW 3.4.2. I'm trying to use getopt_long() in my console application to parse multiple command line arguments syntaxes. I do that by looping through many arrays of struct options. It looks like getopt_long() only processes the first array of options; it returns -1 immediately on the second array onwards. Here's the code I used: #include #include #include using namespace std; int main(int argc, char *argv[]) { static option instArray[] = { { "install", required_argument, NULL, 'f' }, { "name", required_argument, NULL, 'l' }, { "description", required_argument, NULL, 'n' }, { "title", required_argument, NULL, 'd' }, { } }; static option helpArray[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' }, { } }; static struct optItem { char* name; char* shortOpts; option* opts; } optArray[] = { { "Help", "-f:l:n:d:", helpArray }, { "Install", "hv", instArray } }; const unsigned nArrayLength = sizeof(optArray) / sizeof(optArray[0]); // Loop twice with long option arrays for ( int i = 0, option,; i < nArrayLength; i++ ) { int optIndex = 0; cout
wxWidgets frame background color   (153 Views)
Hi! How can I change the background color of a wxWidgets frame
vc6 exception not getting caught in vs2k5   (332 Views)
My application has a small JNI piece written in C++. This piece was developed using VC++ 2k5. We statically link with some .lib's which were built using vc6. I see that exceptions thrown by some api's in these .lib's are not getting caught but are causing the app to crash. When this code was "ported" to vc6 this wasn't observed. It so happens we also support HPUX n Solaris n it works fine there too. Why's this happening
ostringstream and sgetn() weirdness   (293 Views)
hi, i have come aross a strange problem with a bit of code that uses a ostringstream to build up a string and i extract the string into a user buf via the sgetn() call instead of via the str() method. however, it appears that when the contents extracted via sgetn() are invalid for the first extract. below is a test prog that demonstrates the issue. we are using Forte 7.0 on solaris 5.8; i dont have access to gcc (or any other c++ compiler). can someone tell me where i'm going wrong thanks ray #include #include #include #include #include using namespace std; int main(int argc, char* argv[]) { try { ostringstream dump; size_t sz = 0; if (argc == 1) { dump sgetn(tmp, 4); tmp[4] = NULL; dump.seekp(0); // this comes out as empty string!!! cout
'Password protected screen saver' is not getting activated!!   (521 Views)
I have an simple MFC dialog based application. On launch of that application 'Password protected screen saver' is not getting activated after the screen saver timeout. If 'On resume, password protect' option unchecked, I am getting the Screen saver. Application not generating any of the keyboard or any user events to disturb the system. If I exit the application every thing works normal(Means password protected screen saver gets activates after screen saver time out period.) Please help me in understanding, why 'Password protected screen saver' is not getting activated.
How to get rid of VC warning C4239?   (340 Views)
there, I am writing a C++ wrapper for different underlying xml libraries. In order to minimize the use of pointers, i provide a class template to wrap an xml node object pointer, using the pimpl idiom: template class basic_xml_node { typedef basic_xml_node node_type; public: ... // copy constructor: accept a non-const RHS basic_xml_node(node_type& rhs): pimpl_(rhs.pimpl_) { } // copy assignment: accept a non-const RHS node_type& operator=(node_type& rhs) { pimpl_ = rhs.pimpl_; return *this; } // non-const member function. void set_localname(std::string const& localname) { pimpl_->set_localname(localname); } ... private: boost::shared_ptr pimpl_; }; The copy constructor accepts a non-const RHS to avoid the following misuse: typedef basic_xml_node xml_node; void foo(xml_node const& node) { xml_node copy = node; copy->set_localname("toto"); } Since the basic_xml_node class template holds a pimpl to the real xml node object, if its copy constructor/assignment accepts a const RHS, the code above will compile and run, and the effect is that the local name of the const node reference parameter will be changed after the function call. If the copy constructor/assignment accepts a non-const RHS, the code above will no longer compile (which is what i expect). Unfortunately, when i use the class template, VC++ complains a lot on "nonstandard extension used" (warning C4239). Details: conversion from basic_xml_node to basic_xml_node&: A reference that is not to 'const' cannot be bound to a non-lvalue. I think such warnings are benign, but even if the warning id is disabled in my xml header files, such warnings still appear in client code, as long as the client code uses (implicitly) the copy constructor or copy assignment. I know that std::auto_ptr class template has the same problem. So i just would like to know if there is a way to get rid of this warning I do not want to disable this warning globally, or turn down the warning level.
Teaching Myself C++ and getting stuck with a few syntax problems   (361 Views)
Greetings, I have been trying to teach myself C++ over the past few weeks and have finally came across a problem I could not fix. I made a simple program that prints out a square or rectangle using the * character. The program was just for practice but I am having problems. My main problem is, in my program I use 4 functions to change or access two variables in my code. The variables are itsHeight; itsWidth; The functions are getHeight(), getWidth() and setHeight(), setWidth() Now for some reason the value that gets stored in itsHeight and itsWidth goes haywire and saves an astronomically huge number. It makes my square huge to where you cant see it on a screen and takes a long time to print. If I move the two variables outside of the class and make them global, they work like normal. I know I must be doing something wrong. I am also having problems creating prototypes of my functions. I could not create a prototype of my functions that needed to access my Rectangle class. I was forced to define all the functions above the Main and then define an object for each one. I was sure there was a way to use prototypes so you could define your function later, but somehow force the function to recognize my class ahead of time. Does this make sense Right now only my menu function has a prototype. I know defining a function before main is perfectly fine and that making a prototype makes no difference but for the sake of learning, and the sake of organization any help would rock! The programs not done and there might be a few things in here that I am not using at the very moment. That stuff should be commented out. I also have not defined my variables very well between INT, Unsigneds, longs and shorts. This is because I had it all nice and neatly organized to what I think I would need for each function, but then when I hit this brick wall I started changing them to INT to see if it would make a difference. I will go back and make the appropriate changes when I know what im doing wrong. Please lend advise to a newb! #include using namespace std; //Define Variable types typedef unsigned short int USI; typedef unsigned long int ULI; enum BOOL {FALSE, TRUE}; enum uchoose {print=1, area, perimeter, resize, salir}; //declare rectangle class class Rectangle { private: //Private Class Variables int itsWidth; int itsHeight; public: //Public Variables and Functions ULI printArea(){return itsHeight*itsWidth;} ULI printPerimeter(){return itsHeight*2+itsWidth*2;} int getHeight() const {return itsHeight;} int getWidth() const {return itsWidth;} int setHeight(int); int setWidth(int); }; int Rectangle::setHeight(int h) { itsHeight=h; } int Rectangle::setWidth(int w) { itsWidth=w; } void getMenu(); int printRect() { Rectangle rect; int h=rect.getHeight(),w=rect.getWidth(); for (USI x=0; x
Where to get the best (Microsoft?) C++ certification?   (354 Views)
Hi I have good C++ knowledge, but would like to get perfect by study and then get a certification. What is best (online/mail) certication Where can I do tests for it (online/mail) What is the most respectable certification Does it have to be Microsoft certification How about Visual C++, object oriented programming certifications
Use of operator T const& to get a reference to self   (255 Views)
Given the following program: #include class FG { public: explicit FG( std::locale const& l ) : myLoc( &l ) {} template< typename F > operator F const&() const { return get< F >( *myLoc, &std::use_facet ) ; } private: std::locale const* myLoc ; template< typename F > F const& get( std::locale const& l, F const& (*f)( std::locale const& ) ) const { return (*f)( l ) ; } } ; FG getF( std::locale const& l ) { return FG( l ) ; } void f() { std::ctype< char > const& ct = getF( std::locale() ) ; } G++ (4.1.0) instantates the template operator F const& to get the const reference needed to call the copy constructor (which of course fails to compile, since use_facet is not legal). Providing a non-template: operator FG const&() const { return *this ; } solves the problem, but is g++ correct here I would have expected the temporary "FG( l )" to bind directly to the const reference of the (compiler generated) copy constructor. Or maybe my question is: is this intentional Given 8.5.3/5, "[...]If the initializer expression [...]-- has a class type [it does] and can be implicitly converted to an lvalue of type "cv3 T3", where "cv1 T1" is reference-compatible with "cv3 T3" [...] then [...] the reference is bound to the lvalue result of the conversion [...]" But it doesn't seem at all natural to have a user defined conversion called for a copy. -- James Kanze (GABI Software) mailto:james.kanze Conseils en informatique oriente objet/ Beratung in objektorientierter Datenverarbeitung 9 place Smard, 78210 St.-Cyr-l'cole, France, +33 (0)1 30 23 00 34 --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use ] [ --- Please see the FAQ before posting. --- ] [ FAQ: ]
Of getline(cin,...), Ctrl+D and infinite loops   (285 Views)
Here is a small program. It's meant to keep reading lines from the stdin till someone types the (really cute) string "manchu". In that case it breaks out of the loop and the program terminates. /////////////////////////////////// #include #include using namespace std; int main() { string str; char ch; while ( cin ) { cin.clear(); cin.ignore( cin.rdbuf()->in_avail() ); getline( cin, str, '\n'); if ( str == "manchu" ) break; if ( cin.eof() || ) { cin.clear(); } } return 0; } I am compiling this with gcc 3.3.1 on Solaris 9 SPARC, and with gcc 3.2.3 on RHEL 3. Now here is the crux. I wanted that if the user just typed "Ctrl+D", it should clear the eof and fail bits and continue the loop looking for more input. It does this nicely on Linux but goes into an infinite loop on Solaris sparc, repeatedly encountering EOF. I am guessing that this is a wrong piece of code and somehow it is working in one case, and not in the other case. And hoping that someone actually points out where I am going wrong. -- [ See for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]