15,300 Posted Topics
Re: If you want to delete those lines from the file itself then you have to rewrite it. First open that file for reading, then open another temporary file for writing (name it anything you want except don't give it the same name as the original). After that, code a loop … | |
Re: >>function takes 0 arguments What line number? Pay close attention to the parameters of the function prototypes at the top of the program and the parameters (or lack of parameters) passed in lines 44 thru 50 of your program. | |
Re: Without knowing the values of the variables its quite impossible to determine the solution to your problem. What compiler and os are you using? You need to learn how to use your compiler's debugger so that you can single-step through the program execution and see that the variable's values are. | |
Re: The function should be declared to return [b]bool[/b]. If the value is even then return true otherwise return false. | |
Re: program A calls program B. Program B writes some stuff to a file and program A reads it. Or you could use pipes (see man pages for [b]popen()[/b] ) | |
Re: Non-privileged mode operating systems are probably just too small to accommidate all the code needed to protect the hardware from damaging programs. For example MS-DOS 6.X and earlier were already limited to using 640K of memory, and that had to include the operating system and all TSRs, which left most … | |
Re: [quote]Mary Catherine Roper, a lawyer with the American Civil Liberties Union in Philadelphia, took issue with the citation. "You can't prosecute somebody for swearing at a cop or a toilet," she said [/quote] I think you can get ticketed for swearing at a cop, but when he is off-duty he … | |
Re: I did not get any errors with the code you posted. What compiler and os are you using? line 35: never ever use [b]gets()[/b] for anything because it can corrupt the memory of your program. If you type something that is longer than the destination buffer can hold, [b]gets()[/b] will … | |
Re: >> am not able to do that Yup -- you found out the hard way that it can't be done. One solution is to write the variables to a file or shared memory so that other programs can read them. | |
Re: >>will like someone to quickly give me a hint on how to use the mfc classes Ha Ha Ha. [URL="http://www.techtutorials.info/mfc.html"] Here are some tutorials[/URL] >>what i need to know. i wont mind how long it takes if you are willing to help Average learning curve is about one year. | |
Re: Not possible to do it in pure C or c++ because the languages do not support cursor movement. You could do it in MS-DOS pretty easily with TurboC++ compiler. All modern MS-Windows compilers will require win32 api [URL="http://msdn2.microsoft.com/en-us/library/ms682073.aspx"]console functions[/URL]. For *nix I suppose you might have to use curses library … | |
Re: Interesting article about the Flat Earth Society. I'll bet they are also creationists who believe the earth is only 6,000 years old. Both turn a blind eye to scientific fact. As for 9/11 -- my bet is that Bugs Bunny and Daffy Duck were behind it. They probably hired the … | |
Re: even the fstream example you posted is not workable. line 4 does not calculate the size of a file but the number of TCHARs in the file, which might or might not be the same as the size depending on the UNICODE setting. As for CFile, the answer is NO … | |
Re: One huge problem is pointer [b]b[/b] only points to a one-byte empty string which can not be expanded. Since you want a string of 8 characters then you have to allocate memory for it something like this [icode]char b[9] = {0};[/icode]. That will allocate memory for 8 characters plus a … | |
Re: What kind of an object is ListViewTextItem? The second argument to fprintf() is a char*, not a c++ class. fprintf() doesn't know a thing about c++ or objects. | |
Re: My guess is that you need to add a constructor which initialized all the pointers to NULL. As it is those pointers are uninitialized and point to some random place in memory and any linked list using them will fail | |
Re: You mean remove it from CPlanet? or leave it there and instantiate another instance of it in main(). I assume the purpose of CAnimation is to make the class rotate on its axis, so removing it from CPlanet would not be a very good idea. If you instantiated an instance … | |
Re: That's what happens when you jump the gun and dive right into the middle of a program. Its sort of like trying to fly a 747 jet airplain after about 4 hours flying time in a Cessna twin engine prop. You might learn to fly it after crash landing several … | |
Re: line 30 of the header file needs a semicolon | |
Re: >>fgets( str[y], sizeof str[y] / sizeof ( char ), stdin ); The division is unnecessary because sizeof(char) is guarenteed to always be 1. So it can be reduced to this: [icode]fgets( str[y], sizeof str[y], stdin );[/icode]. | |
Re: [QUOTE=WaltP;462277]In other words, brute force. Outputting a bunch of newlines '\n' is the only portable way.[/QUOTE] And that isn't portable either because there is no standard way to determine how many line to clear. | |
Re: link is bad -- on Vista Home Premium I get unknown extension error (*.pl) | |
Re: Did you bother to read the [b]Read Me[/b] links at the top of this board? I thnk there are links to free compilers. | |
Re: Enter the date using a std::string object [code] #include <string> ... int main() { std::string date; cin >> date; ... } [/code] now just use the isnumeric() macro to see if the digit is a digit or not. If a digit subtract '0' from the digit and add the int … | |
Re: read the [b]Read Me[/b] threads at the top of this board because they have lots of information and suggestions. | |
Re: You will want to create a file with *.c extension and VC will compile it as a c file, not c++. Create a new empty project. Then add a new file, when you give it a file name also specify the *.c extension -- such as myfile.c. How you do … ![]() | |
Re: add a float counter and then add the value of [b]counter[/b] to it within the loop that begins on line 7 of the code you posted. >> but my code is all over the board. Looks ok to me, just add the code I mentioned above and you have the … | |
Re: I'm for legalization of marijuana but not other drugs. I have not read anything that indicates marijuana is any more harmful or adictive than alcohol and legalization for recreational use by persons over 21 does not seem to me to be unreasonable assuming the same limitations are placed on marijuana … | |
Re: [quote] think I'm gonna have a nervous breakdown during the presentation. Argh! I'm really not at all good at talking and especially in front of people. >_> doesn't make much sense huh! But I get nervous like hell, and stammer and then forget what I should say, and end up … | |
Re: 1. getScore() is supposed to return a double, but is actually returning a float. If you want it to return a double then declare [b]avg[/b] as a double. 2. The calculation is doing integer arithmetic because 3 is an integer. If you want it to do floating point then it … | |
Re: >>same problem Same problem as what?? I have no idea what you problem is. When starting a new thread do not make it dependent on a previous thread. If there is a problem then you need to describe what the problem is. To keep from repeating yourself you should not … | |
Re: Networking: [URL="http://en.wikipedia.org/wiki/Internet_socket"]google sockets[/URL]. There are hundreds of example programs on the net. One of them [URL="http://www.datareel.com/"]here[/URL] (it has lots of other stuff too that might interest you) | |
Re: [QUOTE=Salem;459238] For the older readership, dig out some of the videos of the late Bill Hicks, then try to justify your asymmetric position on the drugs issue.[/QUOTE] Never smoked pot, but when I was in college Speaking class of some sort during 1970s I started out to prove that pot … | |
Re: you need to use the && operator, not || [code] while (choice != 'Q' && choice != 'q'); [/code] | |
Re: >>i have no idea where to start Start here: [code] int main() { // your code goes here } [/code] You might research some of [URL="http://www.google.com/search?hl=en&q=c%2B%2B+polynomial+program&btnG=Google+Search"]these google links[/URL] | |
Re: I thik below is the correct implentation of that class. One problem with this implementation is that the class is attempting to manage a list of objects that it does not own, and if some other function decides to delete one of the objects it will invalidate the pointer in … | |
Re: I suppose that [b]something[/b] is either Sleep() (MS-Windows) or sleep() (*nix) which will cause your program to get very little CPU time. | |
![]() | Re: I think its pretty funny. :) :) Some people just like to be silly and laughed at. You all are too prudish. Of course, on the flip side of that coin it means he will never be taken seriously on any of the sofware development boards. ![]() |
Re: your examples are kind of screwy but I think I know what you want. There are two ways it could be done -- either as an array or a pointer to the data. The difference between the two is how you want to access the data in func2() -- use … | |
Re: Instead of making 8 copies of that huge array I'd make just two, say array A and B. pass array A to a sort method, after sorted copy B to A and pass A to the second method. Do this for each sort algorithm. It'll save a whole lot of … | |
Re: [QUOTE=dukedoc;459329]Only problem is I can't use maps or any of that fancy jazz. [/QUOTE] [URL="http://www.cprogramming.com/tutorial/stl/stlmap.html"]tutorial[/URL] | |
Re: First, the program you posted is a bastardization of C and C++ languages. As for your problem you need to flush the '\n' (Enter key) from the keyboard buffer after the sscanf(). There are several ways to do that but in C the easiest is to call getc() to remove … ![]() | |
Re: >>Where do c++ developers obtain their libraries learn to use google. It would seem to me that you may have to write a device driver or program that hooks into the keyboard device driver because normally keyboard input is normally routed to the foreground window. | |
[URL="http://www.youtube.com/watch?v=w3I1y3jHgxA"]This[/URL] has got to be among the world's best every written songs! Hope people will enjoy it for hundreds of years to come. :) | |
Re: A more important question is: why is that [b]find[/b] method returning void? A find method normally locates an instance of something and returns the result to the calling function. If it didn't there would be no point to the function as it appears to be with your function. | |
Re: line 36: filename needs to be defined a lot larger than that. If you are using MS-Windows operating system the max filename is 260 (or MAX_PATH if you include windows.h) >>how do i stop displaying text after question D) I suppose you mean that [b]do[/b] loop that starts on line … | |
Any way to get just a quick list of just the thread titles so that the list doesn't cover so many pages of the cplusplus snippets (and others too)? Then if I see one that I might want to look at in more detail I could hover the mouse over … | |
Re: Learn to format your code better so that you can see what you're doing. Only takes a couple seconds to hit that space bar. | |
Re: I don't use *nix but it sounds like a memory leak if there are only a few threads running at the same time. Could also be a limitation of the max number of open sockets at the same time. |
The End.