15,300 Posted Topics
Re: >>Well I got it wrong. Why was you wrong? New programming languages has nothing to do with how bad or good c and c++ are. | |
Re: depends on the operating system. MS-Windows you might want to use a game engine such as DirectX or OpenGL (both are free). | |
Re: >>I managed to read the whole file in one string No you didn't. fgets() will not read the entire file into a single character array because fgets() stops reading when it encounters the first '\n' -- which is the character that terminates a line. So all your program will do … | |
Re: Are you writing a console program or win32 api GUI program, or something else, suh as wxWidgets? | |
Re: They occur because you screwed up. Look at the error messge then the line that caused the error and try to figure out what caused that error message. Sometimes the real problem is on a previous line (or lack of one). | |
Re: AFAIK there is no such book. Code reviewing just tasks a group of programmers to review each others programs for consistency with company coding standards. There is no right or wrong way to do it -- well, almost none. The coding standards will vary from one company to another, so … | |
Re: Practice. Practice. and more Practice. And study books and tutorials -- tutorials are all over the net, just use google to find them. | |
Re: If the buttons are on a Panel container then you need to set the TabStops property so that the Panel is number0 and the buttens each have a higher and unique number. So if the form contains a Panel and two buttons, then the Panel is TabStop 0, and the … | |
I just discovered that you have re-written the Member Rules. I like that :) Very brief, clear, and to the point. I don't know how long its been posted, but all members, both old and new, should be encouraged to read them again. | |
Re: [URL="http://lmgtfy.com/?q=graphics.h+tutorial"]Here it is[/URL] | |
[URL="http://voices.washingtonpost.com/answer-sheet/civics-education/things-to-know-about-labor-day.html"]Today is a Labor Day holiday in USA[/URL]. [quote] Labor Day, the first Monday in September, is a creation of the labor movement and is dedicated to the social and economic achievements of American workers. It constitutes a yearly national tribute to the contributions workers have made to the strength, … | |
Re: Its idential to any other c++ program. [code] #include <fstream> ... ... <snip> std::ofstream out("test.txt"); if( out.is_open() ) { out << "Hello world\n"; out.close(); } [/code] | |
Re: Your program has at least a few problems >>void main() [URL="http://users.aber.ac.uk/auj/voidmain.shtml"]It's int main()[/URL], even though ancient compilers such as Turbo C allow it. >>while(!feof(fp)) eof() doesn't work like that and will cause that loop to execute too many times. >>strstr If you are going to use scanf() then there is … | |
Re: why don't you just have the threads that's downloading the file tell the other thread how much of the file it has downloaded? If you are using sockets the thread that is doing the downloading must know how many bytes it has downloaded, unless of course you are using some … | |
Re: >>Is there a short way to determine how many digits are in an integer In a loop keep dividing it by 10 until the result is 0 [code] while(n > 0) { n /= 10; count++; } [/code] | |
Re: Do you have to write your own sort algorithm? If not, then just use std::sort() which is declared in <algorithm> header file As for your program: I think the loops are wrong. And there is no need for strcmp() [code] int len = deansList.size(); for(int i = 0; i < … | |
Re: >>put in a table C language does not use tables. It has arrays. | |
Re: a character array or std::string | |
Re: You can't do that directly in C or C++. What I would do is create a structure that contains the variable name and value [code] struct item { std::string name; int value; }; [/code] Then you can have a vector of those variables [icode]vector<item> data;[/icode] Another way to do it … | |
Re: [URL="http://lmgtfy.com/?q=portaudio+tutorial"]You mean this?[/URL] | |
Re: I much perfer this instead of all those shifts. The code below could fail for integer overflow. [code] int myatoi(const char *string){ int i = 0; // skip leading white space while( isspace(*string)) ++string; while(*string && isdigit(*string)) { i = (i * 10) + *string - '0'; ++string; } return … | |
Re: Your question is like calling up the auto repairman and saying "my car is broke. Do you know what's wrong with it?" We need a lot more information, such as the source code for the program. | |
Re: Learn to use your compiler's excellent debugger and find out where the problem occurs. Also try to remove those compiler warnings about converting double return value to int. | |
Re: Depends on what you mean by GUI. If you mean MFC then you just buy the Professional version. If you are not going to use MFC then you might be able to get along with the free Express version and download some free libraries that let you write gui programs, … | |
Re: There is no programmable fix for stupid. The programmer of the application which uses your library will probably find it out if he attempts to do things as dumb as you described. Good function documentation should be all that you need to do. See [URL="http://www.daniweb.com/forums/member17893.html"]Narue's avatar[/URL] :) | |
Re: >>what should i do to make it Y>X work as well Simple -- just swap them. [code] int sum = 0; if( x > y) { int tmp = x; X = Y; Y = TMP; } for(x = x + 1; x < y; x++) { sun = sum … | |
Re: >>Good Evening What? did I sleep through the entire Sunday? It's early afternoon where I live. :) Welcome to DaniWeb anyway. >>I was also wondering if there was a 3D/Animation section here No. That's not to say there aren't people here who can discuss it with you here at DaniWeb. … | |
Re: There are more disadvantages than advantages to using inline assembly in c++ programs. I used to use inline assembly 20 years ago in old MS-DOS programs but that was because compilers were not very smart in those days. But today I wouldn't even consider it. Compilers are pretty damned good, … | |
Re: variable element is not a class, its a T* (or int* as used in the test program). MyVector<int> numbers; template <class T> class MyVector : public arrayList<T> template<class T> class arrayList : public linearList<T> { T* element; // 1D array to hold list elements }; | |
Re: >>can't figure out what I'm doing wrong That doesn't surprise me since you can't even figure out where to post this question. | |
Re: what compiler are you using? Your program compiles without error on vc++ 2010 express. replace getchar() with cin.get() | |
is this a hidden menu? I found a thread in it by clicking "New Posts", but I can't find it using Community Center menu. I was going to flag [URL="http://www.daniweb.com/reviews/review309162.html"]this post[/URL] as spam, but so sure now. | |
Re: Another name for it is "cursor". But MS-Windows calls it a caret for some ungodly reason. I always though a caret was something we eat. | |
Re: did you try [URL="http://lmgtfy.com/?q=book+on+data+structures+in+c"]this[/URL]? | |
Re: Does that string represent hex numbers? such as "0A" ? If yes then you don't want to skip the alpha characters. Call [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/strtol/"]strtol()[/URL] to make the conversion. The last parameter to that function should be 16 (base 16 is hexidecimal). | |
Re: Show us the code you have tried. No one here is going to do your homework for you. | |
Re: It would depend on the size of the file and how the file was written. If the file is relatively small (less than 100 meg or so) and the computer has lots of free ram then reading the file into memory and searching would be the fastest. If each record … | |
Re: Oh Good Grief :@ [URL="http://lmgtfy.com/?q=memcmp"]memcmp()[/URL] [URL="http://lmgtfy.com/?q=size_t"]size_t[/URL] | |
Re: I think the easiest was is to use a union then create a vector of those unions. In the structure below, member "kind" is an int that tells what data type is valid -- one of the defines listed. [code] enum DataKind {unknown = 0, chartype,shorttype,inttype,longtype, floattype}; struct data { … | |
Re: clear() does nothing to the input steam. [URL="http://www.daniweb.com/forums/thread90228.html"]Here [/URL]is how to delete everything up to '\n' from the input stream. | |
short program that will build a stl::list of directory names and all the files they contain. recursively calls itself when a new directory is encountered. This has been compiled with both VC++ 6.0 and Dev-Shed compiles on MS-Windows XP Pro. It will not work on *nix or probably MAC computers. … | |
Re: And don't expect to do it overnight -- for some people it might take months or years. | |
Re: you could use a while statement [code] int len = 0; token = strtok(buffer," "); while( token ) { len = strlen(token); token = strtok(NULL,":"); } [/code] | |
Re: File associations are in the registry under HKEY_CLASSES_ROOT. Read [URL="http://msdn.microsoft.com/en-us/library/ms724475(VS.85).aspx"]this article.[/URL] | |
Re: price range: what currency? Can't be USD because here they are only about $500.00 or so. RAM: 2 mg is way too small. Did you mean 2 gig? | |
Re: create a for loop and increment the loop counter by two -- inside he loop call printf() to display the value of the loop counter. Or maybe I misunderstood the question. get a number from the keyboard multiply it by 2 call printf() to display the result | |
Re: why not just call fscanf() to read in those numbers [code] float number; while( fscanf(file_to_be_read, "%f", &number) > 0) { // do something with this number, such as put it into an array of floats } [/code] | |
Re: win32 api function [URL="http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx"]GetKeyState()[/URL] |
The End.