15,300 Posted Topics
Re: [QUOTE=NickyU;657831]I kinda want to do it my self , no DirectX. I want some help like a piece of code to explain, something more explicit than the Wikipedia article.[/QUOTE] Download the source code for OpenGL and you will find the code you want. Otherwise that wiki article looks like it … | |
Re: use [URL="http://cgi.sover.net/cgi-bin/bsdi-man?proto=1.1&query=modf&msection=3&apropos=0"]modf()[/URL] to extract signed integral and fractional values, then multiply the fractional part by 100 and assign it to an integer [code] #include <math.h> <snip> float fractional_part; float integer_part; float number = 999.99; fractional_part = modf(number, &integer_part); int cents = (int)(fractional_part * 100.0); [/code] | |
Re: It works as its supposed to work. rv.i is accessing the private member of its own object. | |
Re: [QUOTE=lahiruchandima;950652]Anyone knows somewhere to learn MFC from begining?[/QUOTE] Depends on the version of the compiler you are using. But here is [URL="http://msdn.microsoft.com/en-us/library/f35t8fts%28VS.80%29.aspx"]Scribble tutorial[/URL]. There are also several good books you can read. | |
Re: >>Does anyone here have any tips on using inb and outb for interacting with hardware on a Linux system? Yes -- you can not use them because the os won't let you access the ports directly. >>Infact, inb(0x61) gives me a segfault. Yup :) | |
Re: No -- text files have to be read sequentially from start to finish. | |
Re: [URL="http://notepad-plus.sourceforge.net/uk/site.htm"]Notepad++[/URL] | |
Re: 1) what kind of database? There are billions of them. 2) Post code. | |
Re: what difference does it make whether you know the rules/regulations or not? If Dani wants to keep accounts forever, what difference does it make? You can always go into your CONTROL PANEL and delete any personal information that you may have posted there. If someone wants an account deleted then … | |
Re: [QUOTE=pierreanthony;949653]hi to all.. I'm into digital recording.. collaboration..? querys on music production.? just drop me a quick message antytime.. cheers to all! -Pierre[/QUOTE] I have zero musical talent, but welcome to DaniWeb anyway :) | |
Re: Welcome to DaniWeb (see Web Development forums). We have a few tutorials but you can probably find hundreds of them with google. | |
Re: You have to allocate memory for the string because GetDlgItemText() does not do that for you. [code] char text[255] = {0}; GetDlgItemText(hwndqw2, IDC_ANSQW, text, sizeof(text)); [/code] | |
Re: >>In release mode, nothing happens. Because asserts are only shown when compiled for debug mode. The same problem exists, its just that the assert does nothing when compiled for release. My guess is that the program has corrupted memory while reading the file or converting to the dialog. | |
Re: In a loop just use the mod operator to switch between upper and lower case [code] int main() { char str[] = "Hello World"; int i; for(i = 0; str[i] != 0; i++) { if( (i % 2) == 0) str[i] = tolower(str[i]); else str[i] = toupper(str[i]); } printf("%s\n", str); … | |
Re: you can not make non-static class methods callback functions. Make the method [b]static[/b] and it should work. | |
Re: That compiler can not compile 64-bit programs. Either buy the Pro edition or use g++. | |
| |
Just want to announce that I am resigning as moderator due to health reasons. It was a pleasure to have had the opportunity to work with all of you DaniWeb members, the moderator team and administrators. I will continue to drop by now and then to see how things are … | |
Re: [code] void change(A* source, A* destination) { destination = source; } [/code] That doesn't do what its supposed to do. All it is doing is swapping pointer addresses and not the objects to which they point. Therefore that function is useless. This is the correction: (Note: you may have to … | |
Re: >>Doctor::get_fee_of_doc That doesn't work because get_fee_of_doc() is not a static method. How does the patient class know who his doctor is? in Patient class you need an instance of (or better yet a pointer to an instance of) Doctor class. And in the doctor class I presume you will want … | |
Re: Next time use code tags. The two streams are local to `Open_Files()` function, so they are immediately closed as soon as that function terminates. What you want to do is pass the stream **by reference** as parameters to that function `void Open_Files(ifstream& inFile, ofstream& outFile)` The similar fix for `Close_Files() … | |
Re: Your program is already using several .lib files from the standard C and C++ libraries. If its a dll that you write and compiled, then most likely your compiler generated a lib file. If its a dll that someone else write/compiled then you might be able to get the *.lib … | |
Re: Start by reading [URL="http://www.daniweb.com/forums/thread70096.html"]this thread[/URL]. Buy yourself one of the good books mentioned in that thread and start studying form page #1. You can also find [URL="http://lmgtfy.com/?q=c%2B%2B+tutorials"]lots of tutorials on the net [/URL]that will get yourself started. | |
Re: most likely you need to use stringstream class [code] #include <sstream> ... ... istream& operator>> (istream& in,Format& b) { //cout<<"enter's format"; string word; string line; char just; size_t count=0; getline( in, line); stringstream str(line); while( str >> word ) { b.add_word(word); count++; } // Not sure about the following // … | |
Re: In order to delete lines you have to completly rewrite the file, omitting the lines you want to delete 1. open the input file for reading 2. open a temp file for writing 3. start a loop that reads a line from input file. If it is not one of … | |
Re: First problem: [code] int main() { string h = "abcde"; std::reverse(h.begin(), h.end()); [/code] The problem with the second function is that the parameter is passed by value instead of by reference. | |
Re: most common way is via ODBC -- use google to search for ODBC and you will find some c++ classes. | |
Re: line 14: where is [b]max[/b] declared? Note that [b]max[/b] is not the same as [b]MAX[/b]. You should use a <vector> instead of string array for two purposes: 1) avoid unnecessary memory allocation, 2) avoid possibility of array overflow (adding too many strings). The <vector> or <list> class will take care … | |
Re: You didn't post the entire program, so I assume you failed to include the header file that declared clock() function. | |
Re: Its easy -- [code] #include <string> #include <iostream> #include <sstream> using namespace std; int main() { string filename, temp; for(int i = 0; i < 5; i++) { filename = "test"; stringstream str; str << i; filename += str.str(); filename += ".txt"; cout << filename << "\n";\ } } [/code] | |
Re: The system() function does not accept but one string parameter, so you have to make the command all one big string. [code] string command; command = "TASKKILL " + cProcess + "/t"; // or something like that system(command.c_str()); [/code] | |
Re: >>Please provide me the solution The solution is to trash that compiler and get a modern one that is compatible with current Windows operating systems. VC++ 2008 Express and Code::Blocks are both good choices. Google for them and you will easily find the links. | |
Re: [URL="http://www.apple.com/getamac/ads/"]MAC vc PC[/URL] Click the Elimination link | |
Re: I would think you should get the answer at [URL="http://forum.thegamecreators.com/"]their forums[/URL] | |
Re: OMG! Only 16!:icon_eek: Computers had not even been invented yet when I was your age -- I was more interested in girls. Anyway -- glad you are here ;) | |
Re: Sane has posted many problems that you can work on. [URL="http://www.programmingforums.org/forum64.html"]Link here[/URL] See especially his Monthly Algorithms Challenges | |
Re: Didn't bother me a bit because I don't use either :) When I want to talk to someone I do it the old-fashioned way -- face-to-face, or ear-to-ear. | |
Re: google for bubblesort and you will get the code you want. | |
Re: Are you sure that compiler has that limitation? If yes, then you might try using win32 api functions as in [URL="http://www.physicsforums.com/showthread.php?t=209526"]this thread[/URL] | |
Re: >>I have 8 gigs of ram, so I know it's not running out of space 32-bit programs can not access all that memory at one time. Each 32-bit program is limited to about 2 gig ram. | |
| |
Re: I wouldn't even consider java for the programs I write -- too damned slow. To me java is only useful in web development and there are probably 10 times more development environments than that. So "use only java" is just not practical or even desireable. | |
Re: We have no clue what that code is you posted, so can't help you very much. >>Just wondering how i could go about this as I cant get the standard variable export import working with it Is this going into a DLL? What is it that you want to export? … | |
Re: You will have to write your own function. But its pretty simple [code] int main(int argc, char* argv[]) { std::string str = "Hello\\nWorld\\\\nAnother\\nWorld"; size_t pos = 0; while( pos < str.size() && (pos = str.find("\\n", pos)) != string::npos) { if( str[pos-1] != '\') { str.replace(pos,2,"\n"); } else { // advance … | |
Re: [code] spnVqw.push_back(SPNstruct(sztempeng,sztempspn)); for(int i = 0; i < 55; ++i) inStream.getline(sztemp, 1000); [/code] I rember telling you this in an earlier thread -- that code is NOT loading the strings into the vector. All it does is read each line from the file ( using getline) ) and does nothing … | |
Re: you might have to go with something like OpenGL or wxWidgets, both have *nix ports (I think) | |
Re: [URL="http://lmgtfy.com/?q=windows+registry+c+tutorial"]tutorials[/URL] | |
Re: >>will the value of counter automatically change as well? No because they are two different variables. Line 10 only initializes the value of counter to be the same as number. From there on the value of counter does not change. >>what is the best way to create a variable that … | |
Re: please post the input file(s) (books.txt, tokens.txt, etc.) It appears the reading of tokens.txt is doing an awful lot of unnecessary work by reading the file one character at a time instead of using getline() to read the entire line into a std::string object. If you want to strip comments … | |
Re: The system function will not work for what you want to do because as soon as system() returns to your program the operating system discards the results of cd and resets the current directory to what it was before the program called system(). This is the same identical behavior of … |
The End.