15,300 Posted Topics
Re: command line arguments are entered into your program via main() function. it has two optional arguments [icode]int main(int argc, char* argv[]) [/icode] argc == number of arguments and always > 0 because the name of the program is 1 argv == array of characters that contain the strings that you … | |
Re: That clip was sooooo boring, I had to stop it after a few seconds. The woman narriating that has a more boring voice than whats-his-name on tv who looks a lot like Henry Kissenger. I don't cut the grass any more -- I pay someone else to do it :) | |
Re: you can use std::transform() to convert the strings to either upper or lower class then use the comparisons [code] std::string s1 = "Hello"; std::string s2 = "HELLO"; std::transform( s1,begin(),s1.end(),s1.begin(),touper); std::transform( s2,begin(),s2.end(),s2.begin(),touper); if(s1 == s2) { // do something } [/code] | |
Re: you need to clear the input stream of all the characters -- see the [b]Read Me[/b] thread about how to do that. | |
Re: 1) [b]static[/b] is a scope operator that limits the scope of the function to the *.c file in which it is declared. If you have two *.c files, each file could contain a function with the same name as long as the function is declared static. IMO its poor programming … | |
Re: you can also call standard C function fstat() or stat(), which will return error if the file is not found. And if it is found it will tell you how big it is -- you can use that info to compare with the original file to see if they are … | |
Re: 1) what are the errors -- or do we have to guess??? 2) you have two main() functions declared. One in the header, where it should NOT be. 3) void main() -- don't use it. main() ALWAYS returns an int. [URL="http://www.gidnetwork.com/b-66.html"]Click here.[/URL] for more info about that. | |
Re: [URL="http://www.mkssoftware.com/docs/man3/strtol.3.asp"]strtol()[/URL] If you want to use pure c++ then use stringstream c++ class. | |
Re: Ok, you stated what the program is supposed to do, now tell us what you did to solve it. Don't know where to start? Try this: [code] int main() { // your code goes here } [/code] | |
Re: As a former tech lady you obviously know it is illegal for anyone to give you a key. The only way to get it is either 1) from HP, who refuses your request, or 2) buy another copy of XP. And thanks for the info about the Trojan. | |
Re: first problem: the while statement is incorrect. Here is how to do it. [icode]while( stats.getline(counter,200) )[/icode] Why do you think strlen() doesn't work? Its been working correctly for millions of programmers all over the globe for over 25 years, so I doubt it has a bug. | |
Re: depends on the error message. compile your program for debugging and find out what's causing the problem. | |
Re: If you are going to plagerize something you would at least post the link where you stole it. [url]http://www.funny2.com/mensrules.htm[/url] | |
Re: The problem is on line 46. The first time through where is only one number in the vector and iterator [b]it[/b] is set to tx.end() because you incremented it on line 44. | |
Re: I don't do MAC but I see two possibilities. The data directory is directly off the root directory [icode]std::string add = "/data/scripts/";[/icode] or The data directory is a subdirectory of the current working directory. [icode]std::string add = "./data/scripts/";[/icode] ![]() | |
![]() | Re: >>The reason for my question was not getting the difference. Ok, so what is it that you wanted to ask? >>I would ask to the point in future.... Absolutely! you can't be vague around here because if you don't know what you want we sure won't either. |
Re: the sort algorithm is wrong. You have to swap all elements of grades array at the same time that the string in word is swapped. You can delete aName2 array. [code] if (word[k] < aName) { // first swap the string in the word array aName = word[k]; word[k] = … | |
Re: [QUOTE=soppyhankins;667295]HA! I just realized I spelled please wrong in the title! That's embarrassing. Lol!![/QUOTE] Ok -- now I'm going to have to ban you for misspelling that word :) Unless you have a Ph.D. in English, don't worry about the small stuff. | |
Re: typecast it [icode]ofs.write((char*)array,512);[/icode] | |
Re: line 6 is declared wrong. Try this: [icode]char test_ar[] = "cdbae";[/icode] | |
Re: post the first two lines of the actual file [code] 100 101something 102another 103yetanother [/code] something like above? Here is an example of how you might do it. This technique should work with an input stream instread of using stringstream in my example [code] #include <string> #include <sstream> #include <iostream> … | |
Re: maybe you should browse [URL="http://www.phpbb.com/development/"]around here[/URL]. | |
Re: all you want to do is save the digits and/or characters of the barcode, not the graphics itself. When the scanner reads a barcode it sends the info to the pc. All your program has to do is look it up in the database. The barcode digits/characters itself is the … | |
Re: I've developed over 40 applications for Mobile 5.0 and Pocket PC using Visual Studio C++. I was able to accomplish a lot of things that most likely are not possible to do with Java, such as forbidding users to access the Today screen, disabling the Start button and the big … | |
Re: Welcome to DaniWeb. There several of us old farts around. | |
Re: Google is your friend if you bother to use it at all. Read [URL="http://www.google.com/search?hl=en&q=c+binary+to+decimal"]this[/URL] and [URL="http://www.daniweb.com/code/snippet109.html"]this[/URL] | |
Re: Scientists normally have Ph.D. in one of the fields of science, such as math, physics, chemstry, biology, etc. [quote="An Engineer"][URL="http://en.wikipedia.org/wiki/Engineer"]Laws exist in all U.S. states, Canada and in South Africa which limit the use of several engineer titles, particularly the title of "Professional Engineer," and often also titles indicating a … | |
Re: A 2d character array? [icode]void foo(char* ay[][255] )[/icode] or like this:[icode]void foo(char **ay)[/icode] | |
Re: [URL="http://forums.devshed.com/c-programming-42/using-std-namespace-what-does-it-mean-45679.html"]This [/URL]is a good explaination. Whether to use [b]using namespace std;[/b] or not to use it is more of a personal preference than anything else. There is no right or wrong way to do it. | |
Re: The constructors are not PUBLIC. What compiler are you using? Did it produce any warnings or errors that you failed to correct? You should treat all warnings as if they are errors because most of the time warnings are indeed errors. | |
Re: read all about binary search algorithms from [URL="http://www.google.com/search?hl=en&q=binary+search+c+algorithms"]these google links[/URL]. | |
Re: line 9: remove the stars. Also, I assume [b]lastname[/b] is std::string ?? If simple character array then that comparison won't work. line 12: should sort the entire structure, not just one of its members [icode]Swap(&gradclass[firstUnsorted], &gradclass[smallest]);[/icode] | |
Re: this might be one way to resolve the different parameters problem. Pass the parameters you want as the seccond parameter and use stdargs.h to retrieve them. If you don't want to do that, then you might get away with using templates, but someone else will have to answer that question. … | |
Re: OUCH! YOU HEART MY ERARS WITH YOUR SHOUTING!!! 1) post error message(s) 2) post enough code to illustrate the problem. We have no clue what STL contains you are using. | |
Re: My guess is that there are lots of ways to make it fail. Just pass the wrong parameters. [url]http://middleware.its.state.nc.us/middleware/Documentation/en_US/htm/csqzal06/csqzal0629.htm[/url] | |
Re: >>Now you can use the usual union membership operator to assign values to individual fields: NO YOU CAN'T. The union is used to assign the same memory location to several different POD (Plain Old Data) type objects. All the objects in the union below occupy the same space, and the … | |
Re: You need to post code and the first fiew error messages (certainly NOT all 88 errors!). I just compiled this with VC++ 2008 Express without error [code] struct data { int x,y; double s,w,e,d; }d[5000],f[5000]; int main() { } [/code] | |
Re: erase() just removes an object from the vector, it does not delete the object. I would write that releaseAll() function like this: [code] static void releaseAll(){ std::vector<ManagedClass*>::iterator first = track.begin() while( first != track.end() ) { delete *first; first++; } track.erase(track.begin(),track.end()); } [/code] | |
Re: MS-Windows is not a real-time operating system, so no matter what you try the signals might or might not arrive to your program on time. You might try the [URL="http://msdn.microsoft.com/en-us/library/aa363196(VS.85).aspx"]Communications Resources[/URL] link | |
Re: write a TSR assuming the os is MS-DOS 6.X or earlier. | |
Re: If you want your own memory block to act like the memory pool allocated by malloc() then you have to write some sort of memory management functions for the pool. Use malloc() only to allocate the initial memory block. After that your program has to keep track of free blocks … | |
Re: std::string is declared in the header file <string>, not <string.h>. The error you reported is because you failed to include <string> in your program. strcat: You failed to declare name large enough to hold both last name and first name, so if you enter last name with 18 characters and … | |
Re: >>i am getting right result which means my coding is absolutely correct. Not necessarily. Did you write pure ANSI C or C++ ? Or did you mix it in with Borland-specific functions ? Just because it compiles with Borland doesn't mean diddly squat if it can't be compiled with other … | |
Re: Why do you have all that MFC stuff in a console program? line 54 is illegal. You can't do that -- its not accessing the memory location on a floppy but a memory location somewhere on your computer's RAM. How to do what you want: I don't know. | |
Re: declare a character array that is large enough to contain the filename and all the arguments, then pass that to the system() function. Example: [code] char command[512] = {0}; char filename[255]; printf("Enter a file name\n"); fgets(filename,sizeof(filename),stdin); // remove '\n' filename[strlen(filename)-1] = 0; sprintf(command,"HandBrakeCLI -i /dev/hdc -o /root/%s -b 1024 -B … | |
Re: Its hard to say why that code isn't working, since we have no idea what Output and Ode are -- resumeably c++ classes. That would normally not be a problem. | |
Re: You are using a compiler with the world's best debugger. You don't need debug messages. Just compile your program for debug and use the debugger to set breakpoints, see the value of variables and program execution. But to answer your question, how to print debug messages depends on whether you … | |
Re: post code. you need to store the filename in either a character array or std::string. Example: [code] #include <iostream> #include <string> using namespace std; int main() { std::string filename; cout << "Enter a filename\n"; getline(cin, filename); cout << filename << "\n"; } [/code] |
The End.