15,300 Posted Topics
Re: you can use getline() with the last argument being the comma instead of the default space. [icode]getline(ins,Lastname,',');[/icode] | |
Re: line 54: for(int i=0; d[i] != 400; i+10) The condition [icode]d[i] != 400[/icode] is never met. Probably should be [icode]i != 400[/icode] or better yet [icode]i < 400[/icode] | |
Re: Use whatever version is supported by the computer's hardware. | |
Re: You can sort the vector without splitting it. call std::sort to do the sorting. All you have to do is to expand the resource number from 1 to 2 digits, such as "resource1" to "resource01" when you read them from the file. That way std::sort (or any other sort algorithm) … | |
Re: [icode](*m_log) << "message;[/icode] The parentheses are not necessary. Just do this: [icode]*m_log << "message";[/icode] | |
Re: The while statement on line 54 is not going to work correctly because it will cause the lzst record in the file to be read twice. One way to fix that is like this: [code] int numRecords = 0; while( ReadRec(inFile, site) ) { ++numRecords; // blabla } ifstream& ReadRec(ifstream& … | |
Re: Do you know how to allocate arrays? Do you know how to read a file? If not, then you need to study them before doing the rest of this program. | |
Re: You could just google for the file name, such as google for "sys/types.h", or just use a text editor to view the file that is stored on your computer. Or ... buy a book that contains all the information. | |
Re: [URL="http://lmgtfy.com/?q=c%2B%2B+linked+list+tutorial"]I'd start learning here[/URL] | |
Re: after allocating the array you have to initialize it to 0 so that strcat() will work correctly the first time. You also have to null-terminate the array after the loop is finished so that printf() will work correctly. Both issues can be solved at the same time by calling memset() … | |
The posts in [URL="http://www.daniweb.com/software-development/c/threads/398622"]this thread[/URL] are in backwards order (newest post first). I looked at other threads in which I did not contribute and they appear in normal order (oldest post first). The creation times of the two posts are reversed. | |
Re: >>ReadDir4.cpp:44: error: ‘struct TFile’ has no member named ‘d_name’ Lear how to recognize the errors in your program. This one is pretty simple and straight forward. Look at the declaration of TFile, located at the top of your program. Notice that is does not have a member named d_name. Now … | |
Re: CSV format is pretty simple -- each record is separated by '\n', as it is in almost every normal text file. Each field is separated by either a comma ',' or a tab '\t'. Which one you use is up to you and might depend on the data to be … | |
Re: Your program seems to work correctly for me on Windows 7 and using VC++ 2010 Express. | |
Re: What would your application launcher do that MSWindows doesn't already do? | |
Re: You need to write code in the OnClick event handler. While in the designor just click the button and the IDE will generate an OnClick event handler for you. | |
Re: not that hard, just locate the first numeric digit then copy both parts to new char arrays [code] char str[] = "staff101"; char s1[6], s2[6]; strnapy(s1,str,5); // copy first 5 characters strcpy(s2,&str[4]); // copy remaining characters [/code] >>any idea guys if c++ can generate pdf See [URL="http://stackoverflow.com/questions/58730/open-source-pdf-library-for-c-c-application"]this thread[/URL] | |
Re: The compiler did not create the dtmf.exe file for some reason. To compile the program as C all you have to do is rename the file dtmf.c instead of dtmf.cpp | |
Re: why download an old and ancient version 6.0? Get the free current version vc++ 2010 Express, easily located by google. >> I can provide the header files myself Are you sure? There are a couple hundred of them. If you insist on version 6.0 you will also have to install … | |
Re: line 25 is using the wrong variable. display TEXT, not search. | |
Re: The while loop is incorrect -- make sure currentPtr != NULL before this loop starts! [code] while( currentPtr->next != NULL) { // blabla } currentPtr->next = newPtr; [/code] | |
Re: line 87: pWalker is an uninitialized pointer and your program is bound to crash. You need to initialize it with the value of the parameter pList. As for the problem you asked about, please tell us which line in the code you posted the error occurs. | |
Re: The loop starting on line 38 never increments the i counter, causing everything to be read into the same element of all the arrays. | |
Re: Those warnings mean that Microsoft compilers now consider standard functions declared in string.h to be depreciated and unsafe to use. You can disable that warning, at your own risk, if you choose to ignore it. [icode]#pragma warning(disable: 4996)[/icode] Put that somewhere at the top (after include files) of the *.c … | |
Re: My guess is the problem is the : [code] wxLegendWindow::wxLegendWindow( wxWindow *parent) ; // <<<< replace the colon wxWindow(parent, -1, wxDefaultPosition, wxSize(LEGEND_WIDTH,LEGEND_HEIGHT)) m_WinParent(parent); [/code] Another possibility is that there are too many ) [code] wxLegendWindow::wxLegendWindow( wxWindow *parent, wxWindow(parent, -1, wxDefaultPosition, wxSize(LEGEND_WIDTH,LEGEND_HEIGHT), m_WinParent(parent)); [/code]\ | |
Re: Happy Birthday! Sorry, but I can't make it, so instead I'm sending you lots of virtual kisses :) | |
Re: why didn't you make both parameters the same type? [icode]T max(T t, T u)[/icode] | |
Re: Since the class has no public members it can't be used in main() But to answer your question, it is common practice to have multiple constructors as long as they have different parameters. Only one constructor will get called, the one with the same type of parameters as the calling … | |
Re: The problem is just the came as in any other c++ program -- the global method must have an instance of the c++ class in order to call one of its methods, unless the c++ class method has been declared as static. [code] class foo { public: static int static_method() … | |
Re: call getchar() to read the file one character at a time, something like this [code] #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]){ FILE* fin; int a, i; char myString[5]; fin=fopen(argv[1],"r"); fscanf((fin,"%d", &a); for(i = 0; i < a; i++) myString[i] = (char)getchar(); mystring[i] = '\0'; printf("%s\n", myString); return … | |
Re: >> foundDecade(string decade) what have you tried ? Since each instance of Celeb::name contains both name and decade just a simple search for some name will not work. To make searches less complicated you might want to split Celeb::name into two separate items: name and decade. [code] class Celeb { … | |
Re: You are not saving the file contents, your program just reads the file and tosses away the information. Turn the program around, first prompt for user name and password, then read the file, making the comparison for each line of the file. | |
Re: Also make sure the PATH environment variable isn't very long. TC is a 16-bit compiler and can't handle long environment variables like 32/64-bit programs can. You may have to use a batch file to shorten the path to only essential directories. | |
Re: I always donate unneeded clothing to [URL="http://www.goodwill.org/"]Goodwill[/URL] | |
Re: It depends on the operating system, but in MS-Windows you first have to empty the folder. Or you can call the shell command "rmdir -S" to remove all the files and folders. [icode]system("rmdir -S c:\mydir");[/icode] | |
Re: The problem is not limited to the UK -- its a big problem here in the USA too, and I assume other countries as well. I know a woman I worked with who was widowed, and within a week was out looking for another man. She found one online who … | |
Re: what compiler are you using? resource.h must be in the same directory as the project *.cpp or *.c files. | |
Re: depends on the operating system if you want GUI shapes what look like the shape should. But if you are a beginner that is way to far advanced for you. But if you're looking for punishment, you can use [URL="http://msdn2.microsoft.com/en-us/library/ms536795.aspx"]Windows GDI functions[/URL] | |
![]() | Re: Windows 7, Google Chrome. No problem logging out. When you log out you should see this screen ![]() |
Today is an American Thanksgiving holiday and we typically gorge ourselves with turkey, sweet potatoes, mashed potatoes, salads, and desserts. If you cook all that at home there is normally enough left overs to last as week or so. This year we decided not to bother with all that cooking … | |
Re: where is the function readint ? How is ecx set to the number of integers that the user wants? Maybe its set in readint? | |
Re: If MS-Windows you have to add an entry in the registry under HKEY_CLASSES_ROOT. If you run regedit.exe and scroll through that key you will see how others do the same thing, just make sure you don't accidentally change anything because you can potentially screw up the entire operating system. | |
Re: What version of vc++ 2008 are you using? Express, Pro, etc. The Express version doesn't come with rc.exe but the others do. | |
Re: duplicate thread. See answer [URL="http://www.daniweb.com/software-development/cpp/threads/396129"]here[/URL] | |
Re: concatenate the two strings before calling system [code] string fname; string pick; cin>>fname; cout<<"Do you want to open the file?"; cin>>pick; if(pick=="yes") { string command; command = "umplayer.exe " + fname; system(command.c_str()); } else cout<<"Thanks for your time; [/code] | |
Re: If you are using Turbo C then most likely delay() is in dos.h. But if you are using a modern compiler then there is no such function. MS-Windows has a Sleep() function and *nix has sleep(). | |
Re: line 16 is wrong. The parameters are only variable names, not the variable size [icode]decode (crypted_string, uncoded_string, key);[/icode] | |
Re: Maybe calculateAvailableUnits() need to round the return value to 2 or 3 decimal places so that it will return 30.00. The problem you are describing in the comparisons will most likely show its ugly head up in other places in your program too. | |
Check out this [URL="http://www.youtube.com/watch?v=Id_kGL3M5Cg&NR=1"]Youtube video[/URL] |
The End.