15,300 Posted Topics

Member Avatar for adcodingmaster

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 …

Member Avatar for Ancient Dragon
-1
147
Member Avatar for adi.shoukat

[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 …

Member Avatar for Ancient Dragon
-2
155
Member Avatar for Bemani_lover

>>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 …

Member Avatar for VernonDozier
1
167
Member Avatar for nated

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]

Member Avatar for nated
1
50
Member Avatar for sonygamer

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 …

Member Avatar for WaltP
-1
104
Member Avatar for taphofyle

[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.

Member Avatar for Frederick2
-1
174
Member Avatar for Ancient Dragon
Member Avatar for ramsdellcp

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 …

Member Avatar for Ancient Dragon
-1
79
Member Avatar for NordCoder

put some debug print statements in the program so that you can try to trace what it is doing.

Member Avatar for NordCoder
-1
2K
Member Avatar for jeezcak3++

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 …

Member Avatar for jeezcak3++
0
136
Member Avatar for tkud

[URL="http://lmgtfy.com/?q=c%2B%2B+vector+tutorial"]See this link[/URL]

Member Avatar for jeezcak3++
0
115
Member Avatar for osmano807

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?

Member Avatar for osmano807
0
76
Member Avatar for Dani
Member Avatar for ~s.o.s~
0
500
Member Avatar for koban_alche

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.

Member Avatar for Tom Gunn
0
138
Member Avatar for sbhavan

.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??

Member Avatar for sivashins
-1
273
Member Avatar for bdub19

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]

Member Avatar for bdub19
0
136
Member Avatar for vileoxidation

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 ?

Member Avatar for vileoxidation
0
222
Member Avatar for power_computer

The two loops are wrong [code] for(x = 0; x < l-1; x++) { for(y = x+1; y < l; y++) { [/code]

Member Avatar for Ancient Dragon
-1
74
Member Avatar for jbennet

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.

Member Avatar for jbennet
0
124
Member Avatar for matthewl

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 :)

Member Avatar for jbennet
0
301
Member Avatar for Ancient Dragon

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 …

1
195
Member Avatar for xfreebornx

[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]

Member Avatar for arshad115
0
83
Member Avatar for tux4life

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.

Member Avatar for Dave Sinkula
1
907
Member Avatar for seakayaker

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.

Member Avatar for vmanes
0
190
Member Avatar for willgr

>>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 …

Member Avatar for Ancient Dragon
0
247
Member Avatar for F.Jor
Member Avatar for DARK_BYTE

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, …

Member Avatar for DARK_BYTE
0
233
Member Avatar for sarvari591

>>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 …

Member Avatar for Ancient Dragon
0
97
Member Avatar for DrakeMagi
Member Avatar for Towely

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.

Member Avatar for siddhant3s
0
189
Member Avatar for acidik_4

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.

Member Avatar for MrNoob
0
74
Member Avatar for DC257209
Member Avatar for Grn Xtrm
0
103
Member Avatar for aomran

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.

Member Avatar for Ancient Dragon
0
358
Member Avatar for rpjanaka

Increasing priority for a thread is not a good idea because it may halt all other threads, including the operating system itself.

Member Avatar for jakethesnake86
0
2K
Member Avatar for Peter_APIIT

You probably have to tell your compiler where pjsip\include is located. How to do that will depend on the compiler.

Member Avatar for Peter_APIIT
0
665
Member Avatar for Dewey1040

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]

Member Avatar for Ancient Dragon
0
3K
Member Avatar for sivapc

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 …

Member Avatar for Lerner
0
189
Member Avatar for welcomepro
Member Avatar for welcomepro
0
381
Member Avatar for MktgRob

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.

Member Avatar for MktgRob
0
71
Member Avatar for Ancient Dragon

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.

Member Avatar for VernonDozier
0
167
Member Avatar for konohastar

>>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 …

Member Avatar for konohastar
0
241
Member Avatar for Ancient Dragon

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 …

Member Avatar for Dave Sinkula
0
352
Member Avatar for anbuninja

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

Member Avatar for Dave Sinkula
0
102
Member Avatar for dag7399

>>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]

Member Avatar for siddhant3s
0
100
Member Avatar for Ineedhelpplz

[QUOTE=Samyx;996915]#include <iostream>[/QUOTE] Can't use that in C programs.

Member Avatar for Ineedhelpplz
0
988
Member Avatar for dumrat

>>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 …

Member Avatar for jyh5
0
133
Member Avatar for adi.shoukat
Member Avatar for aomran

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 …

Member Avatar for aomran
0
124
Member Avatar for adi.shoukat

>>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.

Member Avatar for Ancient Dragon
-1
113
Member Avatar for markrezak

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]

Member Avatar for markrezak
0
273

The End.