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

The problem is that you are leaving the <Enter> key in the keyboard after getting the number of students. After numeric input like that you have to flush the keyboard of the '\n' character.

double sum=0;
        printf("How many students are in class %d?\n",(i+1));
        int t=0;
        scanf("%d",&t);
        getchar();
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I would depend on the programming language. Boost has a regexp library for c++.

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

if you can't use standard C function strcat() then your function looks ok to me. But you could also use pointers

void concatString(char *szTarget, const char* szSource)
{
     while( *szTarget ) 
           szTarget++;
     while( *szSource )
          szTarget++ = *szSource++;
     *szTarget = 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I didn't notice you are using VC++ 6.0 compiler. Yes, I have had that same problem many times. I was also using Nortin Antivirus, and the problem went away when I turned Norton off. I know of several other people who had the same problem with Norton antivirus conflicts with that compiler. Fortunately I don't use either any more.

If you post word.h we could compile and test your programs.

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

Please don't post such huge files any more because some browsers can't handle them.

you can't use STL classes with managed code. System has its own String class which you should use. Read this article

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

Another reason you might get that error is

  • The file is already exclusively opened by another program
  • Some anti-virus programs cause that problem

Try rebooting your computer to see if that corrects the problem.

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

One problem is that you included <string> but failed to specify std namespace. line 975: std::string blabla

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

It won't compile because you commented out a class method in the header file. Look at the error line number, then look at the header file to see where that function is declared. Its commented out!

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

how 'bout you? old geek?.. :) what's your statement?..

You don't want to know because you wouldn't like it.

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

>>Cars and expressways are the transportation solution.
[/code]
They already are -- I have not walked to work in many many years.

>>A home is a good investment.
It has always been, and will probably always be. And its a good investment even today. Just don't try to sell the house and you have lost nothing.

>>There is too much farmland, let's pave it over with malls and streets.
And how do you think we will grow our food if all farmland is converted to shopping malls?

>>Life in the suburb is nice and crime free.
Utopia:)

>>The police will protect my wealth.
Its not the job of the police to protect you our your wealth.

>>The folks that run a bank deserve their bonuses and awards.
Yea, suuuure they will :) :)

>>My credit rating is high and will always be that way.
Credit rating is unimportant -- no long will buy anything with credit.

>> My health care is good and will always be good.
If you are talking about universal health care, it'd better be great for the price we'd pay. Our taxes will proabaly double just to pay for it.

>>Pension funds will take care of my old age needs.
They do that now.

>>Social Security is fundamentally sound.
There is nothing wrong with SS now, and never has been. The problem is congress stealing the …

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

Here is proof that there is no evolution:
With evolution we would use 100% of our brain.:)

Well, we do use 100% of it.

n most famous personal development books, one will inevitably stumble across the following statement: "We only use 10% of our brain". In these books, there is of course reason for joy, because whatever system of thought or change is being taught will definitely remedy that problem. And if we only use 10% then that would explain war, anger, suffering, and all the other fun things in the world. And only some exceptional individuals, such as Einstein or DaVinci are thought to have risen above this low number. But, is that really true? Do we really only use 10% of our brain?

This idea seems to go back to somewhere at the beginning of the 20th Century. While different people are attributed to having said this, it is not even really clear where this comes from, but I know where it is going! Measuring the brain's activity has been done through a wide variety of different tests, from EEG (i.e.: brain wave activity as measure by electrical impulses) to fMRI (i.e.:taking pictures of hydrogen molecules resonating in the brain). fMRI allows researchers to take snap shot pictures of the brain and its activities in particular locations in the brain, and from this research it was found that all of the brain is being used. There was not one area that did not "light …

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

use the fread() function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
while(!fis.eof())
    {
	lines2++;
	fis >> str;
    }

two problemss:
1) that counts the number of words, not lines. If you really want lines then call getline()

2) That will count the last line/word twice because eof() doesn't work lilke that. Here's how to code the loop

while( fis >> str)
   ++lines2;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

C++ doesn't support animation very well -- better off using something like DirectX or OpenGL

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

uploading header files is useless without the libraries that go along with them. If they were not part of your compiler when you installed it then either (1) your compiler doesn't support them, or (2) download the entire Windows Platform SDK. You can also order it on DVD. This is a very large download and may take a lot of time over slow modem or outside USA.

Better approach is to ditch that compiler and download VC++ 2008 Express.

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

The problem may be in another function. Remember, the keyboard buffer is global to the entire program, not just one function.

Also, that function should probably strip off the '\n' character at the end of the buffer, otherwise your program may not process the contents of the buffer correctly.

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

So you think we are going to tell you how to write a bot to spam everyone, including DaniWeb? :D

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

So: client asks server to print a file that resides on the client computer. How do you think the server is going to do that? The client machine would have to be mounted on the server's computer before the server can access that file, unless of course they do a file transfer across the socket connection.

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

And what specifically is the problem?

The only thing I see wrong is that you need to prototype each of those functions that are being called in that switch statement. Otherwise looks like it should compile and work ok.

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

>>A request for filename /root/Desktop/scjp.txt Received..
which machine do you expect the file to reside on? If the file is on the client machine than of course the server don't find it because server is looking on its own computer.

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

Post your version of that file. Mine doesn't have INT64 on line 17. Or maybe you should use a different compiler, such as free Microsoft VC++ 2008 Express.

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

what do you want to know about it? The problem with using system() to change directories is that the directory is changed only while the system() function is doing its thing. As soon as system() returns to your program the directory is changed back to what it was originally.

There is a way around the problem and that is not to use system() but use standard C function chdir() or _chdir() depending on your compiler.

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

There is no ansi c standard way of flushing the input stream. fflush(stdin) is compiler specific becaue fflush() is only guaranteed to work on output streams such as stdout.

If you want a non-standard way to do it you could use fflush(stdin) or functions from conio.h such as

while(_kbhit() ) // while more keys in the keyboard
    getche(); // remove the key

>>The first problem I ran into was that stdin always had '\n' in the buffer
That normally happens only after calling scanf() to get numeric input. fgets() will remove the '\n' and append it to the end of the input buffer if the input buffer is large enough to hold it.

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

>>if ( c == "c")
That won't even compile -- can't use put the character in quotes like that.

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

put all the operators in a character array then use strchr() to see if a character is one of the operators.

const char operators[] = "/*+-()";
while( !empty_optr() && ischar(operators, top->data_optr))
{
   // blabla
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

while(!eof() ) doesn't detect eof like you and many others think. It will allow your program to process the last line or character twice.

why don't you just read a whole line at a time then you don't have to worry about eol character(s)

std::string line
ifstream in("filename.txt");
while( getline(in,line) )
{
    // do something with this line
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did he change his sig as of creating this thread? Because right now its ".....Hi?" which doesn't make much sense with the things that have been posted...

Yes he did change it. So I'm closing this thread because there is no point in keeping it open any longer.

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

Here is one way to do it. There may be more effieient methods

string foo(string& inp)
{
    string::iterator it = inp.begin();
    for(; it != inp.end(); it++)
    {
        if( *it == '~')
        {
            inp.erase(it);
            // now restart the loop
            it = inp.begin();
        }
    }
    return inp;
}

int main()
{
    string input = "a~b~cd~~~eft~hi~";
    string x = foo(input);
    cout << x << "\n";
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This worked for me, where VICTOR is another computer on my LAN.

#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
int main()
{
    string src = "C:\\Users\\Ancient_Dragon\\Documents\\test.txt";
    string dest = "\\\\VICTOR\\SharedDocs\\test.txt";

    BOOL rval = CopyFile(src.c_str(), dest.c_str(), FALSE);
    cout << rval << "\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't know the purpose of all those for loops. If all you want to do is erase the '~' characters then just do that

for(int i = 0; i < inp.length(); i++)
{
   if( inp[i] == '~')
      inp.erase(i,1);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can't call the constructor like you did in main())

int main()
{
	Bicycle myBike(24,17); 
	myBike.printBicycle(); 
	
	return 0; 
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you have write permissions on that computer and directory? Try to copy manually and see if it works.

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

Tough luck. Obama is looking out for #1 (USA) not the world. We here in USA have long disliked outsourced call centers mainly because the person on the other end of the line can't speak English very well, or speaks with an accent that is difficult to understand.

So yes, I agree with Obama that outsourcing should be banned.

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

That makes no sense at all.

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

1) you could store them in different directories.

2) extract a file, rename it, then extract another file. Do that for each of the zip files.

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

The two lines are different. In the first line, arrowlink is of type newNode, while in the second line it is of type q. The two statements are the same only if newNode and q are two different names for the same thing.

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

you didn't say we could change words. In that case: And I said "It was not I"

Actually I would have said "It was not me". But that's a different grammer problem.

It's right to say 'between you and me', and wrong to say 'between you and I'. This is because a preposition such as 'between' should be followed by an object pronoun such as 'me', 'him', 'her', and 'us' rather than a subject pronoun such as 'I', 'he', 'she', and 'we'.

http://www.askoxford.com/betterwriting/classicerrors/grammartips/iorme

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

you could always copy/paste into your own favorite editor, such as Notepad++ which will do what you are looking for.

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

Post just the first 2 error messages and the line on which the error appears. Then maybe someone can help you with that.

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

>>if (gross1, gross2, gross3, gross4, gross5 < THREE_HUNDRED){

That is not the right way to code it. The compiler doesn't complain because its syntaticlly correct -- the comma operator says only gross5 is compared to THREE_HUNDRED

Correct the problem like this: if (gross1 < THREE_HUNDRED || gross2 < THREE_HUNDRED || gross3 < THREE_HUNDRED || gross4 < THREE_HUNDRED || gross5 < THREE_HUNDRED){

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

The only people who must know proper punctuation are those that write text books that teach English grammer. For the rest of us normal people, we can get along quite nicely with a few grammer mistakes. I only use commas where it makes sence to me. "It was, and I said, not I" still doesn't make much sense with or without commas.

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

you should have received a compile-time error on that line because it's syntically incorrect -- _T( macro is never closed, needs a ) before the comma.

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

never heard of ragnarok, but I played Diablo LOD for many years until I installed Vista -- won't play on Vista.

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

Thats mean..lol

You asked for opinions so I gave it to you. Be careful what you ask for ... :)

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

you can delete pointer p since its not needed

while (fread(&records[totalcount],sizeof(entrant),1,fp)) {                
		if (totalcount+1 == curmax) { 
                    curmax+=memincrement;
                    records = realloc (records,curmax * sizeof(entrant));
                }
                totalcount++;
            }

In C language, malloc() doesn't need a typecase.

Or you could use a linked list.

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

wierd -- never noticed that before :)

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

Its disgusting and childish. :twisted:

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

1) try commenting out large sections of code until no more leaks detected.

2) Sometimes it reports leaks that are not really leaks. such as memory allocated by MFC classes or your own code and not yet released when CrtDumpMemoryLeaks() is called.