15,300 Posted Topics
Re: My bet is that you copied some code from the net that was written with VC++ 2010 Express and you are trying to compile it with gcc??? _TCHAR is a macro defined in tchar.h. You can just replace it with char* so that the line looks like this: [icode]int main(int … | |
Re: can't really say the problem without seeing main.h. You probably did not write the implementation of those methods. In any event, get/set methods should not be static because static methods do not have access to instance data. | |
Re: I have a FB account, and twitter too, but rarely use them. But I see your point about labs. I'm a PT WalMart cashier and I could imagine what would happen if I brought a laptop to the register and was on FB all the time. When a customer comes … | |
Re: If you use [URL="http://msdn.microsoft.com/en-us/library/ms682425(v=vs.85).aspx"]CreateProcess()[/URL] instead of system() to spawn Notepad.exe then CreateProcess() will give you the thread id. Here is an example. The PROCESS_INFORMATION structure will contain the data you are looking for. [code] #include <Windows.h> #include <iostream> using std::cout; int main() { PROCESS_INFORMATION pinfo; STARTUPINFO sinfo; memset(&sinfo,0,sizeof(sinfo)); sinfo.cb = … | |
Re: >>string_size = sizeof(argv[count]); Line 20 of main(). sizeof returns the size of the argument, not the length of the string. Since argv[count] is just a pointer, sizeof(argv[count]) is the same as sizeof(char*) which is normally 4 on most 32-bit compilers today. What you probably want is [icode]string_size = strlen(argv[count]);[/icode] | |
Re: why is menu() doing recursive calls in each of those case statements? There is no need for that and those lines should be deleted. The program will return back to the top of that while statement without doing recursion. Line 113 (return) is not needed either. The loop will just … | |
Re: call getline() to extract the variables one at a time using the comma as deliminator. There are several ways to do it, here is just one of them. Note that I did not compile or test the following code [code] #include <fstream> #include <string> using std::string; using std::ifstream; int main() … | |
Re: >>for example if I enter the file name as "1234567" (only digits), It should create "0001234567_OP.txt" [code] #include <sstring> #include <string> #include <fstream> using namespace std; int main() { int num = 12345; string filename; stringstream str; str << num; // converts num to a string filename = "000"; filename … | |
Re: [QUOTE=Kadence;913446] The above doesn't give a compiler error for me, although it doesn't evaluate the or condition.[/QUOTE] If using a Microsoft compiler you have the wrong macros [icode]#ifdef _WIN32 || _WIN64[/icode] | |
Re: >> for int main() why do we always have to write return 0? Its optional in c++ but not in C. The reason is because the c++ standards say its optional. If you don't specify a return value then return 0 is assumed. MS-Windows and *nix operating systems do nothing … | |
Re: I would have thought texting is much more popular today than email, twitter or facebook. People are always texting, even while driving (and getting into accidents) | |
Re: A simple search and replace program would probably to the job. You could probably write your own in a couple hours or get a fancier one on the net (use google). | |
Re: What version of VC++ are you using? I hope its not 1.52C :twisted: MS-Windows sends out a WM_PAINT message when one of the events you mehtioned happens. [URL="http://www.gidforums.com/t-10398.html"]Here[/URL] are a few suggestions how to do it. Capture the WM_PAINT event or implement OnPaint() method, which one to use depends on … | |
Re: @detailer: what compiler are you using? If it doesn't recognize namespace then it may be Turbo C++? The behavior of Ctrl+C is operating system dependent. With most MS-Windows compilers and console programs it causes the program to terminate immediately. On other operating systems Ctrl+C may do nothing at all. You … | |
Re: That question has been asked and answered several times -- see one of [URL="http://www.daniweb.com/forums/search.php?searchid=18463007"]these threads[/URL] | |
Re: [QUOTE=ed_shaw;1604590]If I wanted a lecture in jihad appeasement from the politically correct, I would have requested one. I'm not interested in discussing the issues. Maybe one of the members has the guts to offer up something on the requested subject.[/QUOTE] Your the one who started this crappy thread, so don't … | |
Re: ip is just an int pointer because it has not been set to point to a particular object. [icode]int x = 1; int* ip = &x;[/icode] is a pointer to a variable of type int. ip could also be a pointer to an array of ints [code] int nums[3] = … | |
Re: [QUOTE=sayoojya;1173311]Write a C program to find the factorial of a number using do while loop?[/QUOTE] No. You will have to write that yourself. | |
Re: mysql++ works with VC++ 2010. Must be something you are doing incorrectly. Post some code so that we can see what you are doing. | |
Re: Here is one common example: Write a program that sorts an array of 10,000 random integers using four different sort algorithms, then compare the results (time each one to find out which is fastest). | |
Re: [b]extern[/b] means the variable may be declared in another source file or later in the same source file. See the remarks [URL="http://msdn.microsoft.com/en-us/library/0603949d(v=vs.80).aspx"]here[/URL] Also, the value of global variables are set before main() is called, which is why printf() can display the correct value of that variable. | |
Re: fscanf() won't work for you if the line contains any spaces or tabs. Its better to just use fgets() to avoid that problem. And a better way to code the while statement is like this: [code] while( fgets(data, sizeof(data),separators_f) ) { char* ptr = strtok(data,","); i = 0; int line[5] … | |
Re: I tried a video tutorial once for another language but quickly found out that it was just too difficult to follow the tutorial and type the information into my IDE at the same time. I much prefer books where I can learn at my own pace. | |
Re: what stick are you talking about? A USB device? | |
Re: AFAIK its in the boost distribution along with all of the other boost files. | |
![]() | Re: >>It will probably also mean the end of US military imperialism (if the leaders are at all sensible). And good, its about time US stops trying to be the world police force. IMHO we need to stop fighting other countries wars for them and stop instigating them. ![]() |
Re: You could use an array of function pointers and the index into the array could be the case values, for example [code] typedef struct { int (*fn)(); }fns; int f1() {return 0;} int f2() {return 0;} int f3() {return 0;} int f4() {return 0;} int f5() {return 0;} int f6() … | |
Re: The difference is that class* is a pointer passed by value, while class*& is a pointer passed for reference. Another way to do it is to pass class** (note two stars). Its the same idea as passing an int (or anything else for that matter), such as int is passed … | |
Re: [URL="http://thelongestlistofthelongeststuffatthelongestdomainnameatlonglast.com/long42.html"]Longest name in the world[/URL] | |
Re: [quote] You reached 194 points, so you achieved position 78789 of 308040 on the ranking list You type 297 characters per minute You have 48 correct words and you have 3 wrong words [/quote] I slowed down a bit in the past 20 years. | |
Re: what kind of an array are you talking about? use strchr() or strstr() with character arrays. | |
Re: The first example could be shortened like this [code] string format(double Value, int nPrecision) { char buffer[100]; //Buffer where to store the resulting formatted string. sprintf(buffer,"%0.*f",nPrecision,Value); //Print formatted data to a string return (string)buffer; } [/code] or [code] string format(double Value, int nPrecision) { stringstream s; s.width(nPrecision); s << Value; … | |
Re: >>is this the right way? No because atoi() takes a pointer to a null-terminated string and your variable temp is just a single character. The quickest way is to simply subtract the ascii value of '0' from it like this: [inlinecode]int n = temp - '0';[/inlinecode]. Why does that work? … | |
Re: First, don't use exit(). You need to add a loop to your program so that if you answer 'Y' then the program will just loop back to the beginning and start all over again [code] void addCustomer() { char answer; do // beginning of loop { // put your code … | |
Re: scanf() expects the prameters to be pointers so that it can change the variables values. [b]num[/b] is just an integer, not a pointer, so put the & pointer operator in front of it. [icode]count = scanf ( "%s%n", phone, &num );[/icode] Also see [URL="https://buildsecurityin.us-cert.gov/bsi/articles/knowledge/guidelines/340-BSI.html"]this article[/URL] about %n. | |
Re: For *nix you will want to study [URL="http://en.wikipedia.org/wiki/Motif_(widget_toolkit)"]Motif[/URL], which is not free unless you use [URL="http://www.openmotif.org/"]OpenMotif[/URL]. If you don't want their tools either then use [URL="http://www.x.org/archive/X11R6.8.0/doc/RELNOTES4.html"]X11R6[/URL] (there might be newer versions though). I'm sure you will find tutorials with google. And if you are going to write an extensive toolkit … | |
Re: The statements starting on line 46 are not constructed correctly. [icode]if( category == 'T' || category == 't')[/icode] You don't want to call getchar() inside each of those if statements. Its already called on line 45 so all you have to do is use the value of category. | |
Re: What do you mean "it does not work"? Would you take your car to a repair shop and tell the mechanic the same thing? I hope not. Is that CLR/C++ code (e.g. Windows Forms) you posted? If so, you can not use the standard templates like you would in c++. … | |
Re: Yes it does -- you must be doing something wrong or looking in the wrong place for the *.exe file. | |
Re: I would make an array of tags then all the program needs to do is iterate through the array -- a lot easier than creating 50+ if statements. The array will make it a lot easier to add and/or delete tags too. [edit]arkoenig has a better solution -- use a … | |
Re: Dev-C++ sucks. Use Code::Blocks. I don't know if it will solve that specific problem but it is a lot better IDE which is currently supported by whoever wrote it, unlike Dev-C++ where support is long dead. | |
Re: Reads like an episode of Candid Camera :) | |
Re: line 3 of sortBuff(). That array should be declared as char, not int because you are putting alphanumeric characters into it, not integers. line 19 of sortBuff() -- why is that check even necessary? [code] while( line[i] != '\0') { if( line[i] == ':') { ++line; hexChar = 0; } … | |
Re: Post the code that you have attempted. No one here is going to write your homework program for you. | |
Re: The loop on line 37 will cause the stream to read the last line in the file twice. What you want is like below -- not necessary to test for eof() because getline() will stop when eof() is encountered. [code] while( getline(IN_transposeRowColumn,row) ) { // other code goes here } … | |
Re: [URL="http://msdn2.microsoft.com/en-us/library/ms227408(VS.80).aspx"]Here[/URL] are some tutorials | |
Re: I'm listening to a Moody Blues concert on PBS that was recorded in 2000. Great stuff if you like music of the 1970's and 80s. They were the first group to integrate a full orchastra with rock and it sounds great. I don't know if any other group has ever … | |
Re: You're going to need a 64-bit version of the file i/o functions. For MS-Windows you can use [URL="http://msdn.microsoft.com/en-us/library/aa365467(v=vs.85).aspx"]ReadFile()[/URL] win32 api function. Don't know about *nix. I know ReadFile() isn't as convenient as fstreams, but AFAIK the only way to get 64-bit version of fstream is to use a 64-bit compiler. … | |
Re: >>Have I got this right so far? Yup -- that's all there is to it. Hopefully you are not writing a multi-threaded program :) | |
Re: Sounds like Ron Paul's a winner to me, but that's not likely to happen. >>P.S. What happened to the bad word filter? The word "shit" is not considered a bad word -- daytime American tv rule. |
The End.