15,300 Posted Topics

Member Avatar for lapunluyang

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

Member Avatar for Ancient Dragon
0
163
Member Avatar for qutecynosure

depends on the operating system. MS-Windows you might want to use a game engine such as DirectX or OpenGL (both are free).

Member Avatar for damnigottajoin
0
1K
Member Avatar for Clawsy

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

Member Avatar for Adak
0
151
Member Avatar for deidara1512

Are you writing a console program or win32 api GUI program, or something else, suh as wxWidgets?

Member Avatar for deidara1512
0
244
Member Avatar for SaiBalaji

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

Member Avatar for Ancient Dragon
0
105
Member Avatar for NicAx64

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 …

Member Avatar for chococrack
0
189
Member Avatar for socheata
Re: Help

Practice. Practice. and more Practice. And study books and tutorials -- tutorials are all over the net, just use google to find them.

Member Avatar for Ancient Dragon
0
64
Member Avatar for great_learner

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 …

Member Avatar for Ancient Dragon
0
95
Member Avatar for Ancient Dragon

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.

Member Avatar for Geekitygeek
0
157
Member Avatar for shankarz
Member Avatar for Ancient Dragon

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

Member Avatar for Ancient Dragon
0
97
Member Avatar for great_learner

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]

Member Avatar for great_learner
0
166
Member Avatar for sankhamita

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 …

Member Avatar for Adak
0
118
Member Avatar for Jixz

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 …

Member Avatar for Ancient Dragon
0
152
Member Avatar for scru

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

Member Avatar for Student level
0
476
Member Avatar for NervousWreck

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

Member Avatar for Ancient Dragon
0
87
Member Avatar for atomic33
Member Avatar for Ancient Dragon
-2
113
Member Avatar for ToiNKieZ
Member Avatar for DeweyFinn

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 …

Member Avatar for Ancient Dragon
0
93
Member Avatar for nhidman

[URL="http://lmgtfy.com/?q=portaudio+tutorial"]You mean this?[/URL]

Member Avatar for nhidman
0
87
Member Avatar for challarao

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 …

Member Avatar for Ancient Dragon
0
119
Member Avatar for rapids79

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.

Member Avatar for Ancient Dragon
0
144
Member Avatar for qinise4

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.

Member Avatar for Ancient Dragon
0
185
Member Avatar for malvi

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

Member Avatar for Ancient Dragon
0
87
Member Avatar for oscarp

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

Member Avatar for Ancient Dragon
0
84
Member Avatar for BryantFury

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

Member Avatar for BryantFury
0
201
Member Avatar for Akill10

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

Member Avatar for redesignunit
0
96
Member Avatar for lapunluyang

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

Member Avatar for NicAx64
0
206
Member Avatar for challarao
Member Avatar for MVideoGms

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 };

Member Avatar for Ancient Dragon
0
185
Member Avatar for cjreischl

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

Member Avatar for cjreischl
0
141
Member Avatar for camelCase

what compiler are you using? Your program compiles without error on vc++ 2010 express. replace getchar() with cin.get()

Member Avatar for Stefano Mtangoo
0
298
Member Avatar for Ancient Dragon

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.

Member Avatar for happygeek
0
118
Member Avatar for PixelExchange

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.

Member Avatar for PixelExchange
0
146
Member Avatar for Kakashi Hatake

did you try [URL="http://lmgtfy.com/?q=book+on+data+structures+in+c"]this[/URL]?

Member Avatar for Ancient Dragon
0
77
Member Avatar for Danny_501

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

Member Avatar for Ancient Dragon
0
203
Member Avatar for xshinichix

Show us the code you have tried. No one here is going to do your homework for you.

Member Avatar for xshinichix
0
399
Member Avatar for ms_farenheit1

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 …

Member Avatar for Ancient Dragon
0
149
Member Avatar for Uvais

Oh Good Grief :@ [URL="http://lmgtfy.com/?q=memcmp"]memcmp()[/URL] [URL="http://lmgtfy.com/?q=size_t"]size_t[/URL]

Member Avatar for prvnkmr449
0
157
Member Avatar for AutoC

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

Member Avatar for Ancient Dragon
0
88
Member Avatar for i_luv_c++

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.

Member Avatar for Ancient Dragon
0
92
Member Avatar for Ancient Dragon

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

Member Avatar for ll_MORTAL_ll
0
854
Member Avatar for meer pakala

And don't expect to do it overnight -- for some people it might take months or years.

Member Avatar for GreatWin-Win
0
233
Member Avatar for JayNak

you could use a while statement [code] int len = 0; token = strtok(buffer," "); while( token ) { len = strlen(token); token = strtok(NULL,":"); } [/code]

Member Avatar for Ancient Dragon
0
206
Member Avatar for PixelExchange

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]

Member Avatar for PixelExchange
0
167
Member Avatar for vaishali_mittal

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?

Member Avatar for ApocDen
0
126
Member Avatar for vic18

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

Member Avatar for prvnkmr449
-2
230
Member Avatar for Redhaze46
Member Avatar for falconwise

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]

Member Avatar for falconwise
0
162
Member Avatar for walter clark

win32 api function [URL="http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx"]GetKeyState()[/URL]

Member Avatar for Ancient Dragon
0
107

The End.