15,300 Posted Topics
Re: Post the section of code that is used to write to the Component2-obs.txt. The code you posted does not tell us enough information to answer your question. | |
Re: Yes you can mix both C and CPP files in the same project. C functions can not generally call c++ functions, but c++ functins can call C functions. You just have to tell the compiler which c functions you want to call from the c++ functions. This is how you … | |
Re: There is tons of information available via google [URL="odbc tutorials"]odbc tutorials[/URL] [URL="http://www.google.com/#hl=en&q=odbc+c%2B%2B+wrapper&aq=4&aqi=g6&aql=&oq=odbc+c%2B%2B+&gs_rfai=&fp=b4a8ee3a24fac13f"]odbc c++ libraries[/URL] [URL="http://www.sqlapi.com/"]SQLAPI++[/URL] [URL="http://www.sqlite.org/"]SqLite[/URL] | |
Re: the loop should be something like this. And do not dynamically allocate array a because it is causing you a memory leak (your program doesn't delete[] it). The array size is small enough that dynamic allocation isn't necessary anyway on most modern operating systems such as MS-Windows and *nix. [code] … | |
Re: One way to do it is to copy the string backwards into another character array. | |
[url]http://www.youtube.com/watch?v=LCAdotyM-Eo[/url] Warning: contains GF violence. | |
Re: What's the problem? And next time use code tags | |
Re: [code] /* initialise triangular matrix to zero */ for(i =0; i < dimention; ++i) for(j =0; j <= i+1; ++j) lower_tri[i][j] = 0; [/code] The above causes buffer overrun. The inner loop should be < not <= | |
Re: the array has to be deallocated in the reverse order that it was allocated [code] for(i =0; i < dimention; ++i) free(lower_tri[i]); free(lower_tri); [/code] If you get seg fault with that then it means the program has been corrupted somewhere. | |
Re: You need to force Form to repaint itself before each Sleep(). I'm not sure how to do that (I don't normall write CLR code) but [URL="http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/6b22a6b4-0773-48f9-825d-47f80bc15c42"]here is a start[/URL]. | |
Re: If you are using VC++ 2010 (or 2008) you can create CLR Forms application in which you can easily create text boxes to display the information from the file. google for clr tutorials and you will find out how to do that. I though you said the program reads the … | |
Re: All you need is three very simple if statements, something like below if string length != 2 then error if string[0] < 'A' || string[0] > 'F' then error if string]1] < '1' || string[1] > '4' then error | |
Re: Your compar function is wrong. qsort() sends two pointers to the compare function [icode]int compare(const void* s1, const void* s2)[/icode] In your case it will send two strings, so your compare function needs to typecase the void* to char* [code] int compare(const void*s1, const void* s2) { return strcmp((const char … | |
Re: One common c++ exercise is: Write a recursive function that gathers a list of all the files and folders on the hard drive, starting with a folder specified by the user. You will need to maintain either a std::vector or std::list (your choice) of all the files, and the file … | |
Re: line 11: initialize the variable to be 0, not 1. All arrays start counting at 0. line 13: you can initialize that array to be all 0s when it is declared, elmininating the need for the loop on lines 22-25. [icode]int asciichar [223] = {0};[/icode] line 31: A for loop … | |
Re: >>I keep getting an 'argument not declared in scope' error, even though his works perfectly Talk about a contridction of terms! You get compile errors but yet you claim it works perfectly :icon_eek: Solve the problem in one of two ways: [icode]cop3530::hash_table<int, int, cop3530::linear_probe> ht(10); [/icode] or adding this at … | |
Re: Everything in MFC is handled via events -- messages that are passed through the event handler ([URL="http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/b44f06fb-fc4a-4fac-87cd-48b2953ea5fa"]Windows Message Pump[/URL])located in an MFC function that is called from main(). OnStnClicked() will not be called until program control returns back to that message pump. When OnStnClicked() returns, program control is returned back … | |
Re: I use inline functions frequently in header files but they are really only useful for functions that are only one or two lines. If you do this for functions on in a c++ class then you must declare them with the inline keyword (or __inline depending on the compiler). If … | |
Re: [URL="http://www.codeproject.com/KB/buttons/odib.aspx"]Try this article[/URL] | |
Re: look for qsort() -- all you have to do is write your own custom comparison function that returns an integer similar to strcmp(). The code below assums you are sorting an int array in descending order. [code] int mycomp(const void* p1, const void* p2) { int* i1 = (int*)p1; int* … | |
Re: There is no such thing as = !!. What you want is != 0 | |
Re: Move lines 27 and 28 inside the while loop so that it asks for a temperature on every iteration of the loop. Delete the if statement on lines 30 and 31 because the program already knows how many temps to enter. The while statement on lines 40 and 41 is … | |
Re: Conversion is not necessary. The char data type is a one-byte integer. [code] char x = 2; int y = x; [/code] The compiler will promote the char to int during the assignment. | |
Re: Where in the world did you get that binary seach algorithm??? It isn't nearly that hard. [code] void bsearch(int a[], int size) { int n = 0; int high,low,mid,count; printf("Enter number to be searched\n"); scanf("%d", &n); getchar(); high = size; low = 0; count = 0; do { mid = … | |
Re: Stack::Node says Node is a structure defined inside class Stack. | |
Re: why are you calling malloc() is a c++ program? Change it to new and see if that fixes the error. If not, then the real problem is in parts of the program that you did not post. | |
Re: >>if(output == "file.txt") You can not compare two character arrays like that. You have to use strcmp() [icode]if( strcmp(output, "file.txt") == 0) [/icode] >>if(b == "file.txt") That is trying to compare a single character with a character array. And the line above it is asking you to enter a string … | |
Re: Search [url]www.codeproject.com[/url] -- they have thousands of free MFC classes. If you write MFC then you need to bookmark that site. | |
Re: graphics.h is not supported by any *nix compiler -- it was developed for Turbo C on MS-DOS 6.X and older operating system. So you might as well forget about trying to use graphics.h on *nix or with g++ compiler. | |
Re: See CEdit's [URL="http://msdn.microsoft.com/en-us/library/w9kftda4%28VS.80%29.aspx"]SetSel[/URL] method | |
Re: >>The 2nd parameter confuses me a bit because its typed as an int which is a 32 bit quantity in 32 bit Windows, yet the example above shows a literal char being used character is just a one-byte signed integer. The compiler will promote it to an integer of the … | |
Re: The best one is vc++ 2010 Express. Another very good one is Code::Blocks. google for them and you will find download links. | |
Re: If you want to deal with subfolders then you will have to start by passing *.* to FindFirst() so that it will return all files and foldes. Then your program will have to filter out the ones it wants. There have been several code snippets that illustrate how to do … | |
Re: >> need help solving this. Stuck half way Post what you have done so far. We don't do people's homework. | |
Re: Not a macro, but you can easily write a function to do that. Give it a try and see what you can gome up with. | |
Re: That was three years ago -- the mixture may have changed since then. | |
Re: I suppose you didn't [URL="http://www.opengroup.org/onlinepubs/009695399/functions/isinf.html"]google and find this[/URL] | |
Re: What happens after the third attempt? >>(che = getch()) != EOF EOF is only generated on MS-Windows by pressing Ctrl+Z key combination. How likely is that ever to happen in your program? >>&& i < sizeof(pword) variable i needs to be reset back to 0 before second and third attempts … | |
Re: >> char *cUser[5] That declares an array of 5 pointers. Are you attempting to store 5 different use names in that array? If you are, then you have to allocate memory for them before they can be used. There are a couple ways to do it 1) use static allocation, … | |
Re: CDialog is the class name of a generic dialog class. serverDlg is a class that was derived from CDialog. So if m_pDlg was declared like this: [icode]CDialog* m_pDlg;[/icode] then later assigned to a pointer of type serverDlg then the line you are confused about is typecasting m_pDlg from CDialog to … | |
Re: Do you know how to READ? I assum you do since you know how to write (this thead). Read the [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]DaniWeb Rules[/URL], which you should have done when you joined. | |
Re: turbo c is a 16 bit compiler and can not access win32 api function. So you can't create a windows app with it. Get a modern compiler such as Code::Blocks or VC++ 2010 Express (both are free). | |
Re: In think there are two reasons for that 1) their age. 20 years ago people didn't start programming until they were at least yound adults and therefore had better research skills. Many people today start when they are young children, aged about 10 and the only thing they know is … | |
Re: LPCTSTR is typedef'ed in windows.h as [icode]const char*[/icode]. So your String class will want to return a char* pointer to its character array, or whatever kind of data it holds. [code] class String { private: char* str; public: const char* operator LPCTSTR() { return str; } }; [/code] | |
Re: If it works on MS-Windows its just by dump luck >>line 17: lower_tri[i][j] = values[k]; Look at line 4 and tell me how many floats are allocated to each row of lower_tri array. Answer: Row #0 is 1 float, row #1 is 2 floats, row #3 is 3 floats etc. … | |
Re: A composite key means the key consists of two or more fields. "select price from item_size where field1 = "something" and field2 = "smethin else" and ..." | |
Re: Inside the header file you have to tell the compiler that string is in std namespace. Putting [icode]using namespace std;[/icode] in the *.cpp files is not sufficient because that line is located after the header file that contains the Phone class. [code] class Phone { public: void Set(std::string firstName, std::string … | |
Re: Oh what sad news. We will surly miss him very much. He was one of the best contributors here at DaniWeb. Thank you for posting to let us know of that very sad event. | |
Re: The first thing you need to do is understand the mathametics. Use pencil & paper and work that out so that you know how to make the calculations. |
The End.