Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Wait a second. fgets() is for reading from files

Narue is correct -- why do you believe that? The keyboard is treated just as any file system, just use stdin as the file handle.

>>e.g. If you've continuous gets() functions or a gets() function after a scanf() function then compilers skip that gets() function
That problem is not compiler related. The compiler skips nothing, it doesn't toss out code for no good reason.

In the problem you described, the solution is to clear the input buffer after scanf() call, such as removing the '\n' (Enter key) from the keyboard buffer. In any event gets() should never ever under no circumstances in any lifetime be used. Use either fgets() or gets_s() (if your compiler supports that).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Remember using MS-DOS Version 1.0

Remember using MS-Windows version 1.0 (it was text based)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Too bad you didn't learn C before assembly. In any event, the purpose of the stack is quite simple -- its used to save register values, save return addresses, and to allocate memory for local variables. When the function returns to its caller the stack is reset back to where it was before the function was called. There are two ways to clean up the stack -- (1) the calling function cleans it up after the called function returns, and (2) the called function cleans it just before returning to whereever it was called.

On function entry, one of the first thigs the function does is save the stack pointer in the bp register, then increase the stack pointer to make room for local variables. Just before returning the function changes the stack pointer back to the value in the bp register.

All this would become much clearer if you wrote a small C program had set the c compiler to produce the assembly code. I know vc++ 2010 express will do that, but I don't know about other compilers. I'm almost sure g++ will do it too, but don't know.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I agree with WaltP here. I mean c'mon are these kids just lazy? The lazyness of using not knowing how to spell. I mean... I'm pretty sure it's easy enough to install a spell-checker plug-in into your web browser.

Just pure lazyness. Lazyness is what it is. They should be shot for their lazyness!

Not really laziness -- sometimes just a matter of putting the finger on the wrong key. Good suggestion about a spell checker though -- I need to look into that also :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Davy I think you may have misinterpreted the meaning of the debate. Nobody made any such suggestion.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you know your friend's name then use the advanced search. Click the Search button without entering anything and you will get the advanced search window. You can search for any DaniWeb member that way.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes, post it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are a couple options
1. If your compiler supports conio.h then it contains a couple functions that will do what you want.

2. Use OS-specific api functions. For MS-Windows there are some console functions you can use (link here)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> I think what i said is confusing, do yo think so?
Clear as mud :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I just installed IE9 on 64-bit Windows 7, and I've pinned DaniWeb to my task bar. But the IE9 icon just looks like the standard IE letter 'e'. I read that we need a special *.ico file, see this link

Does anyone know anything about this, because I sure don't.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Activity points is something that was started here just within the last few months, I don't recall when. But everyone started out with 0 activity points and went from there. That's why you will see some members with large post count and small activity points. Take me for example. I have a huge post count but not so large activity points because I'm not as active here at DaniWeb as I once was.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So why do you suppose they're spending all of their money on drugs, where people who have more money to spend aren't?

Probably because they do not have the will power to dry out and get off drugs.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If this were a forum about English grammer then I would agree with WaltP. This isn't, so I don't. The important thing on DaniWeb is that the poster expresses him/herself as clearly as possible, not whether he dotted all the is or crossed all the ts. I don't really care if he uses "their" when "there" was intended.

diafol commented: You wrote what was on my mind +0
sergent commented: :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The error message sounds like you have more than one *.c file with main() in the project. Check your project and remove one of the files.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Look at the logic of the code. Every time you select menu 1 the program allocates an entirely new array of Player objects. The previous array is thrown away, lost forever, and a memory leak occurs. If an array already exists then you need to figure out how to reallocate the array without losing any memory or the previous values in the array. This is one reason why programmers use the std::vector container, because it does all that for you so you can concentrate on the logic of your program instead of how to manage arrays.

And yes, the constructor has to be called for each item in the array, once for value of num_players.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Correct. An even better method would be to use the std::vector container. But you may not be ready for that yet.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Narue -- your avatar is quite appropriate to that comment :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 52: where is player declared? The declaration on line 50 is not in scope at line 52, so it can't be used. Move the declaration of player from line 50 to just after line 42.

why is position a pointer? line 27 only allocates one of them. There is no point using a pointer to allocate a single integer.

predator78 commented: gettin me straightened up slowly but surely lol +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

add string.h library

I don't know how many times this has to be said. BTW string.h is NOT a library!

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Raising taxes and providing services (like good well funded public education by well paid teachers) would help get rid of ghettos and criminals

If that were true than USA would have no ghettos or criminals. The fed government has been redistributing the wealth since 1960s (see LBJ's Great Society programs), which continue to this day, and not even one ghetto has been erased. It only proves that throwing money at the problem is not the solution. And as US President Reagan once said, "Government is not the solution. Government is the problem." .
And crime exists in every neighborhoow, and every class of people. Don't believe me? Just take a look at the problems that Charlie Sheen has had during his lifetime. And Micharl Douglas's son who is currently serving a prison sentence.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

i think hidder files are missing
include the sdtlib.h file.
might work.

No it won't. strcpy() is declared in string.h

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>So just as you could tell two people apart by looking at their fingerprint, you can do it by looking at their typing rhythm

People's typing speed and rythm will change over time. For example I used to type at speed > 100 wpm on a manual typewriter, but I have slowed down a great deal since then. How does your system account for changes in people's habbits?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you also need to include string.h header file, like you did stdio.h header file.

>>what can i do in dev c++
First, stop using that old, obsolete compiler. Download free Code::Blocks with MinGW (they are free).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

struct dirent must not be declared as a pointer

struct dirent entry;
 while ((entry = readdir(&mydir)) != NULL)
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

google for CreateThread(). Here is another good one to read.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

breakfast -- jello with fruit cocktail.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

assuming the number exists in the array, yes. Why did you ask?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I wrote this script for my classmates where we shoot at each other
Remind me never to go to your school.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

See this and this

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

its nearly the same thing

string in = "123";
stringstream out;
out << in;
int thetime;
out >> thetime;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can't do it in pure C without the help of operating system api graphics functions. You can create sort-of a round circle with jagged edges in console program, something like this, which is an awful representation of a circle.

X
   XXX 
  XXXXX
 XXXXXXX
  XXXXX
   XXX
    X
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are compiling for UNICODE. Either turn UNICODE off or make the string literals UNCODE compatible.

#include <tchar.h>
...
<snip>
 TCHAR path[260]={_TEXT("C:\\Users\\")};
   TCHAR filename[30]=_TEXT("*.*");
   _tcscat(path,filename);
    hFind = FindFirstFile(path, &FindFileData);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Another way to do it is to clear the input buffer after cin returns. See this thread how to do that. You will probably also have to clear cin's error flags, such as cin.clear().

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

get the data as a std::string then convert it to integer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes, that is ok. And its [icode] , not IQUOTE

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The technical specification lays out the requirements for the project, AKA project design document. It contains great details of the project, such as screen shots, menus, and a detailed description of the purpose of the project. A project could consist of multiple programs which all work for some common purpose, wuch as Windows Office and Open Office. Both these projects contain multiple programs. The author(s) of such technical specifications may find that it is necessary to split it up into multiple specification documents, such as one for Word, another for Excel, etc.

What will the documents contain? As I already mentioned they will contain as much detailed information about the project as humanily possible. If I come to you and ask you to write a program to help me manufacture widgets then you will write the technical specs to make sure that both you and I agree on what the program will look like and how it will behave. Without such agreement the project will probably fail or will cost you a lot more money then I paid you because you will have to re-write the parts that were not previously clarified. And if I come back again and ask for more changes the previously agreed upon technical specifications will give you justification to ask for more money to pay for the new requirements.

Finally, the technical specification is the document that the programming staff will use to write the program(s).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

int delay = 0; initializes the variable when it is declared delay = 0; is done when you need to re-initialize the variable, such as when its used within a loop as you posted so that it can be re-used for something.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Never saw it -- I don't think its broadcast to USA. Unfortunate.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I never used Quency so I can't really help you with that. Install either Code::Blocks with MinGW or VC++ 2010 Express, both are free.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

disk-based os is cheaper -- you don't have to buy internet connection in order to use it. disk-based os is more reliable and faster. You don't have to rely on other people's computers in order to run your own.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is that the entire program? Or just a snippet from it?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I compile it like: gcc -lpthread programName.c and it compiles fine

How can you say that and then post the error messages that your compiler gave you???

Try reversing the order of the two includes. There might be something in pthread.h that depends on stdio.h but just a guess.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Well, if your program doesn't build then why are you tring to run it? It won't run because the compiler didn't create the new *.exe file. You have to fix all the error messages before you will be able to run the program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm back from working 7 hours now and nothing unusuall happened today (Friday the 13 th). But I didn't really expect any either.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Rhumers are that Apple may not be long for this world due to recent law suits with Kodak. And Apple stocks continue to fall through the floor.

My understanding is that Object C is an Apple product so you can make your own conclusions about how long it may survive.

And, BTW, that may be good news for Microsoft :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

See int 21h, function 2 Read the description for that function and you will find out how to set up the registers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

AFAIK yes, you are right.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

have the dialog class request the data from the network class. The network class should have a get() method that returns the data to whoever calls it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

My grandaughter was born on a Friday the 13th. For her 13th birthday my son bought her the complete collection of Friday the 13th movies. She is now 24.

susheelsundar commented: Great. :) +0