15,300 Posted Topics
Re: The console is a shared resource among all threads. It would be just a jumbled mess if one thread tried to output text to the console screen at the same time you are trying to input text with fgets(). I would think you need to redesign the threads so that … | |
Re: [code] void function( char passedArray[]) { char localArray[10]="my String"; // here i have to use that charArray as string and have to compare it with // localArray. if( strcmp(localArray, passeedArray)== 0) cout << "The two strings are the same\n"; } int main() { char charArray[10] = "Hello"; function( charArray); return … | |
Re: >>Now I haven't enterted the void function yet. But is it ok if I able to use if statements in the void function?, All a void means is that the function will not return anything. Other than that, there is no restrictions on what void functions can do or the … | |
Re: It means the compiler doesn't know what string is. You failed to include <string> header file. After doing that, you need to declare strings as being part of std namespace: [icode]int find(const std::string& str);[/icode] | |
Re: 1. Use binary search to locate an instance of the number it should be looking for. 2. Back up the list until you find the index whose value is different than the one you want. That will give you the starting counting point. 3. Search forward until it finds a … | |
Re: [URL="http://www.endlessquests.com/phpBB3/viewtopic.php?f=19&t=48"]Here [/URL]is another ODBC example that uses MS-Access and the Northwind example database. It does not cover everything that can be done with ODBC, just the basics of how to connect, run a query and get the results. | |
using FF 3.5.3 and attached is how that window looks. | |
Re: why do you need to keep all the old guesses? If the guess is wrong then just toss it out and ask for another guess. cin >> guess[n] is attempting to treat guess as if it were an array, which is isn't at that point. guess is nothing more than … | |
Re: put some debug print statements in the program so that you can try to trace what it is doing. | |
Re: That's still wrong -- use the = assignment operator, not the == boolean operator. [code] vector<string> words(4); //Create 4 elements for now words[0] = "roller coasters"; words[1] = "waiting"; words[2] = "people who talk on the phone while driving"; words[3] = "wars"; [/code] Or use push_back() method if you don't … | |
Re: [URL="http://lmgtfy.com/?q=c%2B%2B+vector+tutorial"]See this link[/URL] | |
Re: deleting the files is simple -- just call remove() function. finding out which ones have not been accessed during the previous 5 minutes is more problematic. By "accessed" do you mean opened for reading, writing or either? | |
Re: That takes too much processing and CPU time. Just use the win32 api function Sleep(int seconds), and don't forget to include windows.h header file. | |
Re: .NET is not a programming language. I'm not quite sure just what it is but its part of MS-Windows os. Maybe you mean c++/CLR?? | |
Re: lines 28-33 are wrong. You can not read a file into a const value, but use variables [code] int arry[6]; for(int i = 0; i < 6; i++) inFile >> arry[i]; [/code] | |
Re: What compiler are you using (if you already told us in another thread then tell us again because I don't want to have to read all your other posts to find out). And how are you linking all those files together ? Are you doing command-line or IDE builds ? | |
Re: The two loops are wrong [code] for(x = 0; x < l-1; x++) { for(y = x+1; y < l; y++) { [/code] | |
Re: The best thing about Code::Blocks is that it's been ported to both *nix and MS-Windows. I wouldn't doubt that it also has a MAC port too. That means you don't have to learn different tools on Vista and *nix. | |
Re: Only one computer at a time -- I only have two hands and one brain, which is single-tasking. I can't tap the top of my head and rub my tummy at the same time either :) | |
If you dual-boot Vista and Fedora or Ubuntu then Thunderbird email client can use a common email box for both operating systems. If you already have an email account set up on one of the operating systems, such as Vista, then open Thunderbird, select Tools --> Account Settings, then click … | |
Re: [QUOTE=xfreebornx;1001522]Hello please how can i get a pointer value that is in for loop???[/QUOTE] The star dereferences a pointer [icode]int x = *poionter; [/icode] | |
Re: CHAR_MAX is undefined -- and should be declared as [icode]const int CHAR_MAX = 255;[/icode] Anything smaller than 255 and that function might scribble outside the bounds of the array. | |
Re: All you have to do is compile it for Release instead of Debug. You may have to install some Microsoft dll's found here: "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT" if the computer does not already have them or newer versions of them. | |
Re: >>The solution was to put "libcurl.lib" in the same directory as the C++ source file which I also added the following line to so it can see the lib. That may be one solution, but not the best solution. The best solution is to tell the compiler where the library … | |
Re: 1) suggest you define macros STDIN and STDOU instead of hardcoding 0 and 1 in the read/write statements [code] #define STDOUT 1 #define STDIN 0 [/code] 2) use sizeof operator to get the size of data [code] write( STDOUT, buf4, strlen(buf4) ); read( STDIN, myArr[i].gender, sizeof(myArr[i].gender) ); write( STDOUT, buf5, … | |
Re: >>wanted solution I want a million dollars too -- will you give it to me ??? Kindly deposit it into my paypal account. Hint to the solution: use strstr() to find the substring, then subtract two pointers (return value of strstr() and the original pointer) [code] char str = "Hello … | |
| |
Re: Post the errors. My guess is that it doesn't like line 10. lines 15 and 16: The value of revl is 0 (line 12) so the results of those calculations will also be 0. | |
Re: You can not set environment variables like that because they are set only while the system() function is running. As soo as system() returns to your program the new environment variables disappear. Its identical behavior in MS-Windows and *nix operating systems. | |
Re: lines 23 and 28: remove those damned semicolons at the end of the lines. | |
Re: Did you start out by creating a new project -- Project --> New -->Project, then select the Console Application icon. Then you have to add both main.cpp and process.cpp to the project. | |
Re: Increasing priority for a thread is not a good idea because it may halt all other threads, including the operating system itself. | |
Re: You probably have to tell your compiler where pjsip\include is located. How to do that will depend on the compiler. | |
Re: don't add the '-' until the words are printed out at lines 18 and 19. Then print two words at a time with the '-' between then. [code] for( int i = 0; i < svect.size(); i += 2 ) cout << svec[i] << '-' << svec[i+1] << '\n'; [/code] | |
Re: You probably should have split this into two different threads because both the problems have different solutions. So I'm only going to comment on the first problem. line 11: This is declaring an unitilized pointer which points to some random location in memory. You have to allocate memory to it … | |
Re: Did you try pointers? [icode]insert(pair<TCHAR*,int>(text,1))[/icode] | |
Re: I wonder if that's why I was unable to login to Tweeter this evening after work?? They must have reset my password, because I had to request a new one and set my password all over again. | |
I have noticed on some boards (e.g. [url]http://www.dreamincode.net/forums/showforum15.htm[/url]) that when I post two consecutive posts the forum software will merge them into a single post. Is something like that possible to do here at DaniWeb ? Of course it would have to be pretty low on the TODO list. | |
Re: >>scanf("%s",&Guess); The "%s" tells scanf() that Guess is a pointer to a character array, not a single character. If all you want is a single character then call getchar() instead. ([URL="http://www.cplusplus.com/reference/clibrary/cstdio/getchar/"]link[/URL]) If you want them to enter "open sesame", which is two words separated by a space, then its a … | |
There appears to be some confusion about what c++ code snippets are supposed to be. I've seen two threads already that are just normal c++ questions but posted as code snippets. I really don't like intermingling the c++ forum with code snippets for two reasons [list=1] [*]Much more difficult to … | |
Re: It doesn't work because calcTotalTime() isn't changing the values of the input parameters. >>really? it compiles for me and runs hmm... Yes -- didn't you try to compile it :S | |
Re: >>Can anybody help me with this question?? Yes, start here. Then post the code that YOU have written and ask some questions if you need to. Read in your text book about loops. [code] #include <iostream> using namespace std; int main() { // put your program here } [/code] | |
Re: [QUOTE=Samyx;996915]#include <iostream>[/QUOTE] Can't use that in C programs. | |
Re: >>My question is whether I need to use locks around Yes, you need to synchronize access to that variable. There are a couple ways to do it: 1) semiphores, and 2) critical sections. Years ago I didn't do either because all it did was increment a global varialble. It cost … | |
Re: see cross-post in C forum. | |
Re: lines 45 and 46: getline() reads the entire line, then on line 46 you are trying to read just a single word from that line. If you need to split up the line into individual words then either delete line 45 and not use getline() at all, or delete line … | |
Re: >>printf("%s",(char*)ch); I've told you about that before in another thread. %s says the next argument is a character array, but all you are passing is a single character. What you should use is "%c", then remove that damned typecast. | |
Re: This should do it [code] vector<pair<string,int> >::iterator it; for(it = wordvector.begin(); it != wordvector.end(); it++) cout << (*it).first << " = " << (*it).second << "\n"; [/code] |
The End.