15,300 Posted Topics
Re: [URL="http://www.daniweb.com/code/snippet579.html"]Here is a c++ example[/URL]. If all you want to do is display the files then you can easily convert it to C by just removing all the vector stuff and printing the filenames instead of storing them in a list of any kind. | |
Re: class variables do not have to be passed as parameters to class methods because the methods already have full access to them. Post an example of why you think you need global variables. | |
I just finished installing Fedora 11 on my 64-bit Vista computer (dual boot) and see that it does not include gcc or g++. I looked on gnu.org, found something that described the gcc compiler package (briefly) but no links to where to download the binaries. Anyone have links to it? | |
Re: [QUOTE=MosaicFuneral;959097]You still get the auto-send message, even if you report your own self. Hitting the submit button a couple times, in the lag, isn't something to cry over.[/QUOTE] Yes you will get an auto-send message about the mod deleting the thread, but you probably won't get the warning, unless the … | |
Re: what compiler? what os? what kind of directives ? Do you mean pragmas or preprocessor directives or something else? | |
Re: >>Is it possible to compile a single .cpp (not a project) in visual studio 2008 No. >>Also will using visual studio cause problems executing code on a unix system? If you mean run the *.exe on *linux, the answer is that it cannot. You will have to compiler it on … | |
Re: I have never received that PM before either. And I ignored it because most of the questions do not apply to me and there were no appropriate answers for someone like me. I started to fill it out, but quit when I got to the part that asked for personal … | |
Re: Is the only reason you are using MFC is to get CString class? If yes then why don't you dump MFC and use <string> instead? The only advantage that CString has over <string> is its Format() method, which is more like sprintf(). [quote]opic since 98 to 2009 CString is extict … | |
Re: [QUOTE=DdoubleD;962196]This is news to me, but it has been a while since I used CPP and maybe it has evolved. My understanding is that any class that implements a "pure" virtual function is an abstract class that forces you to define the function or it also becomes an abstract class. … | |
Re: [QUOTE=crys0011;488040]Do u have any more idea about the advatages of using cin and cout compared to printf() and scanf()?[/QUOTE] Personally I think the c++ implementation of cout is absolutely horrible. In its simplest for cout is pretty easy to use, but get really complicated when you want nicely formatted code … | |
Re: It probably doesn't work the second (and subsequent) time around because the file isn't closed, so it can not be reopened. And why would you want to read that file over and over and over .. and over every time you select option #1??? Just read it upon program start … | |
Re: 1. USE CODE TAGS! 2. Move the open statement up outside the loop. [code] void dptable(int upplimit) { ifstream("favlist.txt"); for(int i=0; i<upplimit; i++) { cout<<fs[i].id<<" "<<fs[i].url<<" "<<fs[i].annotation<<endl; } } [/code] 3. Delete that ofstream object that you put in main() -- it serves no purpose and may cause problems with … | |
Re: my guess is that the filename is passed to your program as an argument to WinMain(), much like argv in main(). | |
Re: [QUOTE=cwarn23;958625]If your trying to read the c++ manual then where is the c++ manual or is cplusplus.com it.[/QUOTE] There really is no one physical manual any more, to RTFM is sort of an archaic term. 20 years ago Microsoft used to ship all the manuals with their compiler. But they … | |
Re: you may have to write the drawing code yourself, but QT is a GUI library that is portable between MS-Windows a *nix. There a few others too, I think wxWidgets is one of them. | |
Re: 1. pass the variable as a parameter to the function. 2. you mean something like this? [code] void foo(int x) { cout << "x = " << x << "\n"; } int main() { int n = 123; foo(n); } [/code] | |
Re: two problems: 1) You have to prototype that function -- meaning you have to declare it before using it. Add this somewhere above function main() [icode]char *long2hex(long c)[/icode] 2) line 11 is incorrect: it should be this:[icode]b[0]=long2hex(a);[/icode] But why did you declar b as an arry of 5 character pointers … | |
Re: No -- derived class has not been constructed at that point. When an object is instantiated the compiler first calls the base class then all derived classes, working its way up from the bottom to the top of the hierarchy. classes are destroy in the opposite manner. | |
Re: look it up in your textbook ??? Also, read [URL="http://www.experts-exchange.com/Programming/Languages/CPP/Q_11622238.html"]this thread[/URL] to get the definition of an "implicit argument". | |
Re: As far as I can tell [b]farmalloc()[/b] is only implemented on 16-bit compilers. There is no such thing as a "far heap" in 32 (or more)-bit programs because they use the flat memory model where all memory is considered near. | |
Re: Another reason for soft deletes is so that the mod (or SuperMod, or other Admin) can reverse the decision to delete the thread. If it were a hard delete then there it can not be undeleted. Mods are human too and sometimes make the wrong decisions. | |
Re: which line of that code are you talking about? | |
Re: >>writer.write(reinterpret_cast<char*>(this) The class can not be written that simply because it contains std::string and pointers. That makes the serialization algorithms much more complex and makes the file a variable length records, almost like any ordinary text file. If you have to use binary format, I would suggest you use character … | |
Re: First you have to know what kind of data is arriving at the port. Then just add the characters to a data buffer. I have no idea what data you are getting, so just assume you want to put it into a character array [code] unsigned char buffer[255] = {0}; … | |
Re: help you fix what??? The most obvious problem is that it is using uninitialized variables a, b and c. Next, function [b]average[/b] only takes one argument, not 3. Either change that function to accept three arguments or only pass one. [edit]^^^ what Tom said. [/edit] | |
Re: just change the filename. Otherwise how to do that will depend on the compiler. Some compilers have option flags to do that and others don't. | |
Re: 15. never plan/design a new program, just start typing and see where it will take you. 16. write programs in assembly language. higher-level languages are for wimps. | |
Re: A double click is nothing more than two clicks in rapid succession. Your program will get two click events, not one. [edit]Never say never! If you are using Windows hooks then you might want to read [URL="http://www.codeproject.com/KB/cs/globalhook.aspx?msg=852443#xx852443xx"]this article[/URL], especially one of the comments at the end of the article. | |
Re: Windows batch files isn't sophisticated enough to do all that. You will need to write a small program in one of the man programming languages such as C or C++. Is this the output you want? [quote] AAAUSA-0046,AAAA,AAAAA061,100.00 AAAUSA-0057,AAAA CCCC -,AAAAA026,100.00 Press any key to continue . . . [/quote] | |
Re: >>if(_stricmp(value,gen_arr[i])== 0){ gen_arr a single character array? or is it an array of strings? If its a single character array then do this (without indexing) [icode]if(_stricmp(value,gen_arr])== 0){[/icode] | |
Re: Welcome to DaniWeb. Didn't realize we were on the Atlantic ocean :) | |
Re: open the file, seek to end, get position, then finally check if position is 0. [code] ifstream in("myfile.txt"); in.seekp(0, ios::end); int spot = in.tellg(); if( spot == 0) { cout << "Empty file\n"; } [/code] | |
Re: Easy implementation. It becomes a little more complicated when you want to also use '*'. Much more complex implementations can be found in boost regex library (regular expression library). [code] bool wordPattern(string pattern, string word) { if( pattern.length() != word.length()) return false; for(int i = 0; i < word.size(); i++) … | |
Re: There isn't a forum for it because no one has ever asked a question about it and the likelyhood that Dani will create another forum for it is very very remote. Post such a question in "Legacy and Other Languages" forum. | |
Re: Just try to open it -- if open files then its probably already opened (assuming COM1 exists and there are no hardware problems) | |
Re: [quote]4. String formatting using <iomanip.h> header file[/quote] OMG :icon_eek: You mean to tell us that you school is teaching you the wrong stuff! iomanip.h has been deprecated (obsolete) for almove 10 years now. The current file name is <iomanip> (no .h extension). I wonder what else they have been trying … | |
Re: 1) yes, but beware of stack overflow if the array is too large. 2) probably, but some operating systems may not deallocate it. 3) I don't know. | |
Re: you have not written the implementation code for the functions in those two classes. | |
Re: The 'C' just means C-language. >>Is that a common practice in software development? No. Microsoft coders like to use such prefixes in their classes/structures, but not in filenames. | |
Re: What exactly is an "interactive menu"? One that talks back to you? And "interacts with you" ? A menu that shocks the keyboard if you do something wrong? | |
Re: [URL="http://msdn.microsoft.com/en-us/library/aa363194%28VS.85%29.aspx"]This is what you are looking for[/URL] | |
Re: Just how big is your bank account anyway? Did you take your own silly advice? | |
Today my wife and I have been married (to each other :)) for 47 years. Going to wine and dine this evening so you won't see me around for the rest of today. | |
Re: There's Open Source, freeware and public domain. Almost everyone uses free software of one sort or the other. FireFox is just one of many. And there are a lot of free compilers and editors. Would I use them? Of course I would (and do). :) But what does this have … | |
Re: must be something else wrong because this compiles ok with vc++ 2008 Express [code] class A { public: void* ptr; A() {ptr = 0;} }; int main() { A* a = new A; int* p = static_cast<int*>(a->ptr); *p = 1; } [/code] This one also has no problems [code] class … | |
Re: you have to link with the appropriate DirectX libraries. When you downloaded the DirectX SDK you also got a lot of sample programs. Look in them and they will tell you what libraries you need. Or you can just read MSDN to find that out. | |
Re: Are you using MFC or win32 api functions? When you created the edit box you got a HANDLE to the object. See [URL="http://msdn.microsoft.com/en-us/library/bb761661%28VS.85%29.aspx"]this article[/URL] | |
Re: line 6: >> fstream file(nome, ios::in || ios::out || ios::binary); You are using the boolean || operator, not the bitwise | operator | |
The End.