15,300 Posted Topics
Re: Write a comparison function that compared the substrings of each string. [code] #include <iostream> #include <string> #include <vector> #include <algorithm> #include <ctype.h> using namespace std; string getsubstr(const string& s) { size_t pos = s.find('-'); string v1 = s.substr(pos+1); // now remove any leading white space characters while( isspace(v1[0]) ) { … | |
Re: [code] #include <iostream> #include <string> using namespace std; int main() { string str = "Hello*World"; str.replace(5,1,"%2A"); cout << str << "\n"; } [/code] | |
Re: go to [url]www.codeprject.com[/url] and search for tab control examples. They have a lot of mfc code that you can look at to see how its done. | |
Re: I think what you want is an ftp library -- [URL="http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS328&=&q=c%2B%2B+ftp+library&aq=0&oq=c%2B%2B+ftp+&aqi=g10"]here are some links[/URL]. | |
Re: I suggested that same thing a few months or a year ago but was boldly ignored. Dani is not amiable to creating new forums for whatever reason. | |
Re: >>was hoping u or some one wood direct me to a specific scource.... since were in C++ forum There is no specific source. Modular programming is a concept, not something you can show and say "well that's it.". If you really googled like previously suggested then the very first link … | |
Re: [URL="http://support.ipswitch.com/kb/WSK-19980709-EM01.htm"]winsock error 10061[/URL] | |
Re: [URL="http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS328&=&q=ascii+table&aq=0&oq=ascii+&aqi=g10"]Here [/URL]are a few tables that will show the ascii codes for all possible values. Note that decimal values 0 thru 32 are not printable so you won't see anything on your screen for them. Only values 33 thru 126 can be shown on the screen. | |
Re: Install the [URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en"]Redistributables [/URL]and your program should be ok. Also read [URL="http://msdn.microsoft.com/en-us/library/zebw5zk9.aspx"]this article[/URL] carefully. | |
Re: Try this. GetNext() simply returns NULL and that is not what you want. [code] void Lobby::AddPlayer() { //create a new player node cout << "Please enter the name of the new player: "; string name; cin >> name; Player* pNewPlayer = new Player(name); //if list is empty, make head of … | |
Re: [URL="http://download.microsoft.com/documents/useterms/Windows%20XP_Professional_English_9e8a2f82-c320-4301-869f-839a853868a1.pdf"][quote="Microsoft Enduser License Agreement"]Installation and use. You may install, use, access, display and run one copy of the Product on a single computer, such as a workstation, terminal or other device (“Workstation Computer”). The Product may not be used by more than two (2) processors at any one time on … | |
Re: If all you want to do is download a file then [URL="http://msdn.microsoft.com/en-us/library/ms775123%28VS.85%29.aspx"]this is the function for you[/URL]. Also see[URL="http://www.daniweb.com/forums/post930586.html"] this thread[/URL]. | |
Re: Second problem: look up in your textbook about Pure Virtual classes and functions. Third problem: 1. pulblic: -- mispelled 2. Shape needs a default constructor (one with no parameters) | |
Re: >>Sure, it might feel harder in the short term, but I think we would reap the benefits eventually And just what are the benefits of communism? I haven't seen any around the world, such as in China and Cuba. All I see in communist countries is grief, sorrow, and enslaved … | |
Re: after the cin line call either toupper() or tolower() then make the test. | |
Re: [QUOTE=br99;929548]I'm trying to write a GUI program where I want to use both strings and vectors, but the computer won't recognize them no matter where I try to include <string> and <vector>. Can you tell me where in the code I need to put my includes and my std namespace?[/QUOTE] … | |
Re: I don't know what you mean by "helping yourself" and "security part" of DaniWeb. I don't think we have anything like that. | |
Re: Observation: string.h is a standard C header file -- rename yours to something else to avoid filename clashes. In MS-Windows file names are not case sensitive like they are in *nix, so String.h is the same file as string.h, which is clearly not what you want because your program is … | |
Re: Serkan: your whole problem is that you need to get yourself a nice woman to satisfy your lustful desires. One who can relate to you both body and mind, not someone just in virtual computerland. Get married, have a few kids. But stop that kickboxing, it ain't healthy for you … | |
Re: You might try Microsoft's winnet.dll internet functions here and here | |
Re: The only reason I buy it is so that I can have it where I work. Otherwise at home my refrigerator has a cold water filtered facet that is quite cheep to operate. The bottled water that I buy costs about $0.12/20-oz bottle, or about $0.75/gallon. If you are paying … | |
Re: No, I think he's asking how a business can profit by providing open-source software. I know that Red Hat Linex maked their money on technical support and customizations. Similar with MySQL. | |
Re: Use either [URL="http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS328&=&q=odbc+c%2B%2B+tutorial&aq=0&oq=odbc+c%2B%2B&aqi=g8"]ODBC[/URL] or [URL="http://www.google.com/search?hl=en&rlz=1G1GGLQ_ENUS328&q=ado+c%2B%2B+tutorial&aq=f&oq=&aqi="]ADO[/URL] in c++ programs. Neither are for the faint of heart and require a firm grasp of c or c++ fundamentals. Microsoft's MFC class also has a database class. Once you have the query, I'd put the query contents in a [icode]vector< vector<string>>[/icode] object, assuming all … | |
Re: Oh you people complain about a few minutes boot time! You should work with mainframe computers which can take several hours to boot. Of course I realize you don't have mainframe computers on your laptops :) I've been using Vista Home Premium for a couple years now and have grown … | |
Re: Here is another way to do it since the requirement is to use <vector> class. [code] #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> using namespace std; int main() { vector<float> ay; for(float i = 0.0F; i < 1.0F; i += 0.1F) ay.push_back(i); vector<float>::iterator it = ay.begin(); for( ; it … | |
Re: [code] int distance = 0; char str[] = "Hello World"; char *ptr = strstr("World"); if( ptr != NULL) distance = ptr - str; [/code] | |
Re: A program that runs on the development computer but not on other computers normally indicates there are one or more missing DLLs on the computer that it don't run on. And that is usually because the program was compiled for debug, not release. Recompile both the application and DLL for … | |
Re: m_pointVar has to be a pointer for that to work. If it isn't, then how to check will depend on the class. Make the class constructor initialize all its variables and the program user won't have to worry about whether it was initialized or not. Testing for NULL pointer will … | |
Re: I've found that some compilers don't care whether you put in quotes or angle brackets. I personally like using the quotes to make it easier to distinguish compiler standard headers from others. | |
Re: Welcome to DaniWeb. There is lots of posts here for you to help. And yes, we don't do people's homework for them either. | |
Re: In C language the fgets() function will trim leading and trailing spaces from words read. It will also skip over '\n'. Text files do not contain '\0' bytes; if your file does then it is not a text file. | |
Re: >>what do I change to see a different name at the top? Are you concerned with the version of the compiler (e.g. VC++ 2005 or VC++ 2008) or the version of the program? -is duplicating folders the best method for making new versions? IMO -- yes. The released version of … | |
Re: The first parameter needs to be a reference or pointer to a pointer. All that function is doing now is changing its own local copy of the pointer. Suggest either of these changes: [icode]void double_array_1d(int** arr, int length)[/icode] or this [icode]void double_array_1d(int*& arr, int length)[/icode] If you use the first … | |
Re: Welcome to DaniWeb. Just how "elderly" are you anyway? If you are over 100 you might have problems learning to program :) Where to learn depends on the programming language. But we can discuss that more in [URL="http://www.daniweb.com/forums/forum5.html"]DaniWeb IT Professionals' Lounge[/URL]. | |
Re: >>so it just bogs the shit out of the game..... anyone have any ideas on this? Yes I know. Database access is always slow. Maybe you need to shove the database access code in another thread so that it doesn't affect the game. And your problem will only get worse … | |
Re: [URL="http://msdn.microsoft.com/en-us/library/bb775941%28VS.85%29.aspx"]Read this[/URL] -- send WM_ENABLE message to the button. | |
Re: you could use getline() with the third parameter [code] string word; while( getline(infile, word, ';' ) { cout << word << "\n"; } [/code] | |
Re: std::string's find() method then use std::string's substr() method to extract the string. IMO its better than strtok() because it doesn't modify the original string. If you were using c++/CLR then it's String class has a Split() method, but that isn't standard c++ and works only with Microsoft compilers. | |
Re: The new c++ standards, which will not be released for some time yet, is supposed to allow arrays to be allocated like that: [icode]int ay[size][/icode] where size is not a const integer. A few compilers may already support it, but if they do it is compiler-specifc. | |
Re: You mean you want help on how to keep your team members happy and still be able to develop the DLL? >>do you define an interface, then write the implementation to a DLL, then pass the DLL around, then. Basically, yes that's the way to do it. But it doesn't … | |
Re: >>First time I compiled it with MicrosoftC++ and gave me just 1 error, that corrected You should have tried to compile it again with that compiler. I used VC++ 2008 Express and the code you posted had billions of error messages. There are indeed several errors. 1) struct art -- … | |
Re: Post the code you tried to write. | |
Re: Look in the directory in which the project is store -- the name of the header file is most likely Form1.h. >>Also i want to access its controls for updating. Don't know. | |
Re: I don't know a thing about Chinese characters, but I would suggest reading the file 2 bytes at a time. After reading 2 bytes test to see if it is a valid Chinese character. If not, assume its two ascii characters. Then write out either the chinese characters (which are … | |
Re: Worked ok for me. Post the code you tried and a few of the compiler errors. | |
Re: Maybe you should use a check button. Or search t[URL="http://www.codeproject.com/KB/buttons/"]hese links[/URL] for something similar to what you are looking for. codeproject.com has a wealth of MFC and other code. | |
Re: [QUOTE=jbennet;921465]Happygeek and Dani have the same powers as a global mod already.[/QUOTE] Actually they have powers way beyond that of a SMod. | |
| |
Re: >> string s = "data.txt"; // an example Delete that line |
The End.