15,300 Posted Topics
Re: Did you see [URL="http://www.atheros.cz/?gclid=CKKZp5KY0JUCFQKaFQodAmiYiQ"]this link ?[/URL] | |
Re: >>medalArray.country[i] That's the wrong way to access the array [icode]medalArray[i].country[/icode] BTW: you should rename that array to something else to prevent confusion (you and your prof) between the structure name and the array name. | |
Re: [URL="http://www.google.com/search?hl=en&q=differences+between+Object+Oriented+and+Structured+Programming.&btnG=Google+Search&aq=f&oq="]read these google links[/URL] | |
Re: The win32 api function you want is [URL="http://msdn.microsoft.com/en-us/library/ms724942.aspx"]SetSystemTime()[/URL] | |
Re: The moderators are alive and well. The OPs post was just too damed funny to warrent deletion. I wanted everyone to share in his humor. Sounds like it might be a good start to a winning game. | |
Re: >>Are lists stored the same way, no. Lists are linked list and each node has its own memory location. >>But, I have also read that the memory that was previously used can only be filled with a vector that is small enough to fit in the old space. The old … | |
Re: >>turbo c? (c++ 6.0) What is that? Are you talking about two different compilers -- turbo C and VC++ 6.0 ? You can not use gotoxy() with VC++ 6.0 compiler. | |
Re: Why XML format? Look at these [URL="http://www.google.com/search?hl=en&q=memory+mapped+files&aq=f&oq="]memory mapped files[/URL] links | |
Re: There is lots of information on the web that explains those things for you. [URL="http://www.google.com/search?hl=en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=c%2B%2B+functions&spell=1"]Just search google[/URL] | |
Re: >> but what else can I do to put in CR and LF to the end of strings? simple [code] char str[100] = "a string"; // see Salem's post #2 for this line strcat(str, "\r\n"); [/code] | |
Re: You first need to write a function that returns the factorial of a number. Be careful here because those values will grow very large very quickly. Calculating factorials in c++ programs has lots of limitations due to small numeric sizes. See limits.h for the maximum size of an integer or … | |
Re: You need to use the pointer [icode]cout << " " << it->time;[/icode] or like this: [icode]cout << " " << (*it).time;[/icode] | |
Re: >>i need to include the last update date and time of the record in the form of dd-mm-yyyy,hh:mm:ss(it has to be updated by th program automatically) and i don't really know how. Just add another field called UpdateDateTime (or whatever you want to call it) to each record which would … | |
Re: post the code you have written and we'll try to help you. | |
Re: blessing12 has already been banned by someone, so I doubt you will get any more of those PMs. | |
Re: >>I almost completed the system You still have more clean-up work to do. 1) stop using [URL="http://www.gidnetwork.com/b-56.html"]gets()[/URL] and [URL="http://www.gidnetwork.com/b-57.html"]fflush(stdin).[/URL] . You are writing a c++ program, not a C program. So replace gets() with cin.getline(). And [URL="http://www.daniweb.com/forums/thread90228.html"]read this thread[/URL] how to flush the input stream. 2) Login problem. You need … | |
Re: you must mean the number of digits in a number, You're program is almost right, except the while statement should check for t > 0, not t >= 10. That function doesn't need variable t at all, just use the parameter variable x. | |
Re: google for ODBC. There are some free c++ classes that will help you. Do you know the SQL language? If not you need to google for that too. | |
Re: >>If there any function in C++ or C to resolve the problem Nope. The only way to get rid of characters is to completly rewrite the file, unless the characters happen to be at the end of the file. | |
Re: getline() will get an entire line, including white spaces. [code] ifstream in("filename"); std::string line; int counter = 0; while( getline(in,line) ) { counter += line.length(); } [/code] | |
Re: In MS-Windows and *nix operating systems a program can only write to memory that it ownes. The old MS-DOS days are gone forever, so writing to specific memory addresses as it was possible in MS-DOS 6.X and earlier is just no longer possible. And assembly would be of no value … | |
Re: >>fgets fails to work completely as advertised, Nope -- it has been working correctly for millions of programmers all over the world during the past 25 years. If there was a bug in fgets() then it would have been found and corrected years ago. The problem is in your program, … | |
Re: I can only give you a vague answer because of your vague question addContact: Information can only be added to the end of the file. How to do that depends on how the file is opened. [URL="http://www.cplusplus.com/reference/clibrary/cstdio/fopen.html"]See the open flags here.[/URL]. My suggestion is to use the "a" flag so … | |
Re: It really depends on what you mean by zero-length string and how you want to use it. If its the source string in the functions you mentioned then yes, they can be safely used there. But if they are the destination string, then safety will depend on how the string … | |
Re: Sorry to tell you that the only way to add something to the beginning of a file is to completly rewrite it. | |
Re: zip up the project and attached it to your post. I'll give it a try. Make sure you deleted all compiler-generated files first to make the zip file smalller. | |
Re: What part(s) of the assignment don't you know how to do? main() has two optional parameters -- argc and argv. [icode]int main(int argc, char* argv[])[/icode] argc is the number of parameters on the command line -- normally it is a minimum of 1, but on some embedded systems it could … | |
Re: >>I dont know where I am going wrong. any help is cool The first error tells you what is wrong. You can't have two functions that differ only by their return type. Overloaded functions must have different parameters. | |
Re: >>first of then strlen only counts the characters in the first word of the line I put into console The problem is your code, not strlen(). The >> operator stops accepting data from the keyboard when it encounters the first space or tab. All the rest of what you typed … | |
Re: It'd be nice to know what operating system you have and what kind of computer (or is it your mother-in-law you are talking about :) ) | |
Re: IMO use MFC objects when available. In the two cases you cited it doesn't really matter to the compiler, it just makes your program more consistent if you use the MFC objects. | |
Re: worked ok for me, after I fixed the bug [code] int str_compare(const char *str1, const char *str2) { if (*str1 != '\0' || *str2 != '\0') { if (*str1 != *str2) { if (*str1 > *str2) { cout << "str1= " << str1 << " " << "str2= " << … | |
Re: >>void main() [URL="http://www.gidnetwork.com/b-66.html"]read this[/URL] As for your problem: [code] int main() { int sum[256] = {0}; ifstream in("filename"); char ch; while( in.get(&ch) ) { if(ch > 0) ++sum[ch]; } // now just display all the rows in sum that are greater than 0 } [/code] | |
Re: Yes, we can HELP you but we will not write it for you. You have to write the program then post questions about what you don't understand. I believe the first thing you need to do is design the contents of the data file. What data do you want to … | |
Re: how did you declare it in your vb program? what you posted appears to be correct. But you don't need both the *.def file and use of _dllspec(__export) -- all you need is one of them. | |
Re: They are just jealous *nix users because MS-Windows is soooooo much easier to learn and use. | |
I had to change computers because my other one bit the dust a couple days ago (64-bit Vista/IE7). Now when I log into DaniWeb I can't see the mod menus in Coffee House -- see thumbnail. | |
Re: I just compiled/linked with VC++ 2008 Express without a problem. What was the exact error message? What you quoted was only an indication that one or more errors occurred. | |
Re: Because the pointer has not been initialized to anything. It just points to some random location in memory, which your program may, but probably does not, own. Before using a pointer you must initialize it to point somepace. For example: [code] int *pVar; int number; [color=red]pVar = &number;[/color] *pVar = … | |
Re: flush is a function so you need to use () [icode]cout.flush()[/icode] Try this macro [icode]#define PRINT(x) (cout << x << "\n" )[/icode] | |
Re: Did you try something like this? [code] #include <iostream> #include <string> #include <vector> #include <fstream> using namespace std; void foo(ifstream& in) { } int main() { vector<ifstream*> streams; for(size_t i = 0; i < 5; i++) { ifstream* in = new ifstream; streams.push_back(in); streams[i]->open("filename.txt"); } foo( *streams[1] ); } [/code] | |
Re: This probably won't solve your problem, but ... Do you really need that vector? Why not just combine those two loops? | |
Re: The reason is because entering numbers leaves the '\n' (Enter key) in the keyboard buffer. cin.ignore() will just remove the '\n'. So you either need another cin.ignore() or do what you did and use cin.ignore(2) | |
Re: >>Can Any one guide me for this. As a batch file, forget it. Can't be done. There is no way to send anything to an already running program from a batch file. But you can write a C or C++ program to do that and call that program from the … | |
Re: >> what would I name my file or doesn't it make any difference? It doesn't matter -- name it whatever you want. Text files normally have *.txt extension, not *.dat. >>So how do I have to call out this file in main? With ofstream its not necessary to specify ios::out … | |
Re: The error message is pretty clear about what is wrong, and the solution sould be obvious: where did you declare MUSHROOM_END ??? | |
Re: [quote]The function top() returns a reference to the top element of the stack.[/quote] [url]http://www.cppreference.com/cppstack/top.html[/url] It does not return NULL, but returns a reference to the first object in the stack. Checking for NULL is not a valid thing to do. | |
Re: how was the file opened? as text or binary? If binary then the next line character(s) depends on the operating system. In MS-Windows/MS-DOS you need "\r\n". *nix just "\n" and MAC "\r". If the file is opened in text mode then the operating system will make the appropriate translation of … | |
Re: I suppose you could use the time functions in time.h [code] time_t t1, t2; t1 = time(0); t2 = t1 while( (t2 - t1) < 1) // one second t2 = time(0); [/code] You might also check the [URL="http://www.boost.org/doc/libs/1_36_0/doc/html/date_time.html"]Boost time functions[/URL] | |
Re: Maybe [URL="http://www.codeproject.com/KB/dialog/Viewsinfullscreenmode.aspx"]this article[/URL] will help you. |
The End.