15,300 Posted Topics
Re: use a loop that counts from 1 to the number you enter, then another loop that counts backwards back down to 1. Print the loop counter. | |
Re: [URL="http://www.dreamincode.net/forums/topic/21309-cpp-with-odbc-open-database-connectivity/"]Here [/URL]is one of many tutorials you will find. I wouldn't exactly call ODBC "dead easy", but you only need a good grasp of C or C++ language. In order to do anything useful you will need to learn SQL (Structured Query Language). Again, there is lots of information on … | |
Re: Code::Blocks is an IDE that can be used on both MS-Windows and *nix, while Fedora is an operating system. | |
Re: [code] #include <sstream> #include <string> #include <windows.h> using namespace std; string date() { SYSTEMTIME stime; GetLocalTime(&stime); char buf[40] = {0}; sprintf(buf,"%02d/%02d/%04d", stime.wDay, stime.wMonth, stime.wYear); string dt = buf; return dt; } [/code] | |
Re: >>ifp=fopen("in.txt","r"); That is opening the file in text mode while fread() expects binary mode. Suggest you replace fread() with fgets() if you want to keep text mode. >>fread(text[0],sizeof(char*),1,ifp); sizeof(char*) is always the sjze of a pointer, which on MS-Windows and *nix 32-bit compilers is 4. And that's why fread() is … | |
Re: I have never found a need to copy the vtable in any of my c++ programs. I normally use Microsoft compilers and have never encountered a vtable problem with them. If you use a compiler that has such a problem then get yourself a different compiler. | |
Re: When you start the program it sets the current working dirfectory to the folder which clontains the source files. So if you put that file in the debug folder then you copied it to the wrong folder. Put the file in the same folder as the *.c and *.cpp files. | |
Re: >>When is not going to be available a shell? Some embedded systems don't have a shell. I have not used all operatin gsystems so I suppose there could be a few others out there too that don't have shells. MS-Windows and *nix will always have one available. Instead of testing … | |
Re: Your question is a little fuzzy -- what kind of object do you want to create when the time is entered? Are you talking about a clock? | |
Re: If you ask really really nice you might ask one of the mods to remove the code you posted, leaving the rest of the post. | |
Re: Have you already written the server and you just want to port it to MS-Windows? | |
Re: use ifstream. Assuming status is a file and not a directory it would be like this [code] #include <fstreeam> using std::ifstream; int main() { ifstream in("./proc/1/status"); } [/code] | |
Re: take the program you have and strip out all the calls to graphics.h functions and what is left is what you probably want to incorporate into your VC++ program. My guess is that there is other code in that program to support the graphics functions which you will not need … | |
Re: People who break the laws are more than just "disobediant" -- they are criminals. Just because you don't like a law doesn't give you the right to disobey it. Are there laws that shouldn't exist -- Yes, but the way to get around it is to change the law, not … | |
Re: >>if no one answers my thread i cannot get to it again See that purple ribbon at the bottom of the screen? It contains several links -- one of them is "Threads I've Posted In" and another "Threads I've Started". Just click "Threads I've Started" and DaniWeb will show you … | |
Re: >>i have no idea on how to go about it, start here. Now fill in the function shown below with your program requirements. Do only one little part at a time, compile and correct all errors. Then do a little more and repeat until all requirements have been fulfilled. Example … | |
Re: After getting the date and number of days, use functions/structures in time.h to do all the hard work. First populate a struct tm with the year,month and day from keyboard input, then add in the number of days to mdays field of the structure. Finally call mktime() and it will … | |
Re: what is %2 supposed to mean? Or do you just want to print %2 on the console screen? If yes, then just use int 21 instructions to do that, assuming you are using Intel or compatible processor. | |
Re: >>Why does it jump back to the turbo c window when I press enter to enter my age? Is this wrong? because you didn't tell the program to do anything else. If you want it to wait so that you can see what's on the screen, put a getch() at … | |
Re: If your program is calling OpenFileDialog() then you need to set the RestoreDirectory property to TRUE so that it does not change the current working directory on you. | |
Re: >>Our professor ask us to upload our program in a website, I've been searching through the web with possible ways, but I still can't figure it out how to do it. Whose web site? The professors? The web site should have a link to upload files to it. If you … | |
Re: Check the compiler output screen to see if it recognizes thse pragmas. I know those functions are in ws2_32.lib. Its possible the pragmas were ignored. | |
Re: I see another new stat too -- number of activity points. I have never noticed that before, and assume it's reset to 0 each day. Might be interesting to have a link that would show a graph of total activity points for each day over the past month or so. … | |
Re: you are using the same fstream object to do both reading and writing. That is ok, but you have to call seekg() between the two in order to reset the file pointer back to the beginning of the int that was written. [edit]Or use ifstream and ofstream as ^^^ suggested. | |
Re: [URL="http://www.daweidesigns.com/cgi-bin/pointers.php"]Here [/URL]is a pointer tutorial from DaWei | |
Re: On MS-Windows I use either VC++ 2010 Express or Code::Blocks. On *nix (rarely) I use Code::Blocks. Never had a reason to use Eclipse. In the early years of programming (1980s and 1990s) I used a text editor, something like Notepad or VI and compiled everything from the command line using … | |
Re: You can use / in both MS-Windows and *nix. C:/foo/bar.dat If you still want to use \, then the only time you need \\ is in string literals which are surrounded by quotes. Paths read from a file or returned by some other function do not need \\. | |
Re: Try [URL="http://www.cplusplus.com/reference/clibrary/clocale/setlocale/"]setlocale[/URL]() | |
Re: The reason is that there are only a limited finite number of resigers available to the program. For example on Intel and compatible processors there are only 6 register variables in common use throught the program (eax,ebx,ecx,edx,esi and edi), so it would be impossible to store global variables in them. | |
Re: >>lblName->Click += gcnew System You do NOT use += in that line, just =. | |
Re: Its crashing when extend() is called from the class constructor because you failed to initiailze class variables before calling that function. Line 65 is trying to delete an ininitialized pointer. That is bad regardless of what compiler you used. | |
Re: Hopefully you will not need to make very many changes to the source code. MS-Windows uses winsock instead of berkley sockets, so you might want to skim through [URL="http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS397&=&q=winsock+tutorial&aq=0&oq=winsock+tutor"]one of the tutorials[/URL] to see what changes you may need to make. As for MySql, I don't think you will have … | |
Re: [QUOTE=~s.o.s~;289626] If yes then what did marriage change in your life, are the new found responsibilities burdening you or making you a better person ? Regards, ~s.o.s~ PS: I am single and for me marriage is a sacred relationship...[/QUOTE] I have been married (to the same woman) 43 years next … | |
Re: An easy way to find out if the problem is your new program is to run it from the command prompt and redirect the output to a file, such as [icode]c:\myprogram >myfile[/icode] After the program finishes check the contents of the file to see if it contains the data you … | |
Re: Even the title of this article is obnoxious-- a "wet dream" is what teenage boys experience. So are you trying to say that male programmers will ejeculate at the thought of iPhone 3.0? | |
Re: Such a class would keep all the digits as a vector, array or linked list of characters, and you could make it so that it has no upper or lower limit to the number of digits it can hold. >>May you get me started? Certainly -- here goes [code] #include … | |
![]() | Re: You can not open the same file twice. Use just one FILE* pointer and open it for both reading and writing if you need to. |
Re: Apparently the design works -- everyone is talking about it aren't they :) :) | |
Re: You could write it with c++ and use QT, which is a cross-platform GUI compiler. | |
Re: Have you studied structures and linked lists yet? If you know structures, then create a structure that contains two items: the double value and an int count of the number of times the value occurs in the original list. Then make an array or linked list of that structure. You … | |
Re: There are a couple of ways to delete a book from the library. 1. Rewrite the entire file, and omit the book that is to be deleted. 2. Mark the book to be deleted so that other functions just simply skip it when reading the file. One way to mark … | |
Re: yes -- add another thread and put the code for your clock in that thread. | |
Re: >>What do you guys/gals think I hate it because it does nothing more than obfuscate the program. Maintainability and readability are more important than cuteness. | |
Re: You have to use strcpy() to copy character arrays -- assignment operator doesn't work. [icode]strcpy(temp_last,record[j+1].last_name); [/icode] | |
Re: int instructions only work for the interrupt functions that are pre-defined by the operating system. printf() and scanf() are not define by the os api therefore it's not possible to perform int instructions to access them. Those are higher-level functions defined by the C language. google for int 21 instructions … | |
Re: You most likely have a project that contains two or more *.cpp files, and two of the files have main() defined in them. Delete the one you don't want. | |
Re: line 51: strcmp() returns 0 when the two strings are the same. | |
Re: [URL="http://www.codeguru.com/cpp/cpp/cpp_mfc/tutorials/article.php/c9855"]Tutorial[/URL] | |
Re: pixelmap::pixels is NOT a multi-dimensional array -- it's a single dimentional array. You have to add one star for each dimension. For example, for a 2 dimension array you declare it as [icode]pixel** pixels;[/icode] Then allocate it like this: [code] this>pixels = new pixels*[height]; for(int i = 0; i < … |
The End.