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

I agree with about one thing -- most of the negative things people have said about each candidate is just speculation. I recall when JFK was campaigning that many republicans feared the Pope would rule America if a Catholic was elected President, and that just turned out to be so much election-time hype.

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

you need to learn how to create event handlers, which are functions that you write that MS-Windows calls then someone clicks on a menu item or button.

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

fin.open(inFile);
is this what you mean???

Maybe -- depends on what inFile is defined to be. If it's a std::string object then fin.open(inFile.c_str());

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

All politicians do that -- say one thing and then a day or so later say something else. McCain and Sara Palin are no different, so its not really a big deal. I believe Obama is the best one for positive change in Washington. McSame is no different than GWB and the past 8 years. If you want another 4,000 american soldiers KIA in Iraq then by all means vote for McSame.

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

The ifstream fin was never opened. You have to call fin.open("<the filename here>"); before line 170

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

Did you near Obama change the level from $250 to $120 ? I didn't. So that republican spear campaign add it just so much crap because they know they are really desperate.

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

If you are using MS-Windows then use FindFirstFile() and FindNextFile() to get the names of all subdirectories, then recursively call the function to process the files in each subdirectory. I have posted a code snipped that may help you here. It will get a list of the files that you need to copy. From main() just pass "." as the first argument to TransverseDirectory().

You can then call win32 api CopyFile() to copy each of the files in the vector that is returned by TransverseDirectory().

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

Yes, they are stored differently. The sizeof(int) and sizeof(char) are not the same (on most machines). The c++ compiler (and standards) enforce parameter types and number of parameters. If you tried to pass an integer to a function that only expects a character it will have lots of problems because a (signed) character can only old values -126 to 127. See limits.h for exact range of values for each data type.

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

As far as I know _stat is a System V world function. The sys/stat.h header is not standard too...

You are right about it not being standard C header file -- I had used in in both *nix, unix, MS-DOS, and MS-Windows and just assumed it was standard.

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

You are using a Microsoft compiler, and it creates projects that, by default, use precompiled headers. If you want to use precompiled headers then the very first include file must be stdafx.h

#include "stdafx.h"
// other stuff here

If you don't want to use precompiled headers then go to Project --> Project --> C++ tab --> Precompiled Headers and turn them off. (Assuming VC++ 2005/2008 compiler)

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

The function arguments must be the same type. f and g take an int, while h takes a char.

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

mouse functions only get and set the mouse coordinates on the screen and, by itself, has nothing to do with scrolling. The only way I know of to cause scrolling via the mouse is to use scrollbars as I mentioned previously.

>>i am not getting right registers in which these programs are available.
I don't know what you mean by that. What compiler are you using? If Turbo C, then see this article about mouse functions.

Also read these google links

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

The stat() or _stat() function will also validate the existance of a file and will return some information about the file

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

I don't think there is any set rule -- depends on the message. Look at the message description in MSDN. Some say to return TRUE if you want to base class handler to be called, or FALSE if you don't. Also, in some cases you may want the base class to handle the message before you do, which is the case in the code snippet you posted. In other cases you may not want the base class to handle the message at all.

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

try starting a new console Hello World project and see if it links ok. It that's ok then add the files in the project that gives you the problem.

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

I know with MS-DOS 6.X and earlier it was possible to do that pretty easily with assembly code, but for console windows in MS-Windows I don't think it is possible. If you have a win32 GUI program then you would implement scroll bars

You might also check out some of these sample programs to see if yoiu can find something useful.

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

I heard about this on talk radio station this afternoon. Votors need to watch what happens very carefully. I trust those electronic voting machines even less than the paper ones (hanging chads).

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

That's because you enclosed the \0 in double quotes. Change it to single quotes pPtr->myArray[127]= '\0'; If myArray is less than 128 bytes then the above will cause buffer overflow.

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

>> getline(istream& fin, string& num_of_isbn, char '\n');
That is a function prototype, not a function call. As written, it will do nothing. If you want to actually call getline() then you need to change it to this: getline(fin, num_of_isgn); -- Not the '\n' parameter (last parameter) is not needed because that is the default.

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

some compilers complain if the last line of the file is not a newline. In the editor go to the last line and hit <Enter>. That should fix that warning.

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

The while statement is incorrect. The eof() function doesn't work the way you think it does.

while( joke.getline(data, 256) )
{
  // blabla
}

After the above loop finishes data will contain the last line of the file.

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

you can use getline() to read each line, and count line numbers. Then use stringstream to split the line into words.

#include <string>
#include <fstream>
#include <iostream>
#include <sstream> // for stringstream
#include <vector>
using namespace std;

struct words
{
    string word;
    int lineno;
};


int main()
{
    vector<words> wordlist;
    words thisWord;
    int lineno = 0;
    string line;
    ifstream in(filename.c_str());
   while( getline(in, line) )
   {
         lineno++;
         stringstream s;
         s = line;
         string word;
         while( s >> word )
         {
             thisWord.word = word;
             thisWord.lineno = lineno;
             wordList.push_back(thisWord);
         }
     } 
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You posted your assignment and code, so what now? Are we to just admire the code you posted?

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

You are asking the impossible. We can't prove without a doubt that we all have the same ancestor as apes/monkeys, etc.. None of us was around then. .

That is exactly my point. Until evolution can be proven it will remain just another theory. Sure there is lots of evidence that points to evolution, but we all know what false evidence proved :) For those who may not know, the attached thumnail is a vamous (to us Americans) picture of newly elected President Truman holding the front page of a major US newspaper that said Dewey won.

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

>>What I couldn't figure out is how to find the word's location in a line
According to the description of the program you posted all you need is the line number, not the location within the line. For line numbers, just use an integer to keep track of them. You also need to add int lineno to the BSTree class so that line number and word can be printed together.

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

You all can experiment with flies and mice all you want, but that proves nothing. How often have medical experiements on mice proven to be invalid in humans? I want to see you prove without a doubt that man evolved from monkey or that man and monkey had the same ansestor. If you can prove that then you will be in the textbooks forever.

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

The ls command is not sorting alphabetically using standard ascii decimal values. If you look at a standard ascii chart you will see that a space has a lower decimal value than any letter, and that's why "A aa" is before "Aaa". Maybe its sorting by file creation time or something like that.

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

The two tests you posted look like two different directories -- they are not even close to listing the same files.

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

typecast each character, such as

std::string x = "guy";
cout << (int)x[0];

Now, just put that in a loop, replace the 0 in [0] with loop counter and you have it.

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

Ask Narue -- she told me awhile back that she collects old computer books.

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

You can join website like http://forums.digitalpoint.com/ , post few threads in programming section , after 15 days you can post "signature for sale" in link sale section , you can make as much as $40/link/month or more .

NOTE: I am not affiliated to digitalpoint .

Thanks for the tip, but that link doesn't work. I went to digitalpoint.com but could not find a forums.

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

After cin >> choice; you need to flush the keyboard buffer of the '\n' character (Enter key). Just add cin.ignore(); after those lines and it should work

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

The argument to XStart.exe contains spaces, so you need to wrap double quotes around it. See red

_tcscpy(tszCommandLine, _T("C:\\Program Files\\Hummingbird\\Connectivity\\12.00\\Exceed\\Xstart.exe \"C:\\Documents and Settings\\username\\Application Data\\Hummingbird\\Connectivity\\12.00\\Profile\\XSW3.xs\""));
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Briefly, here's one way to solve it from Narue's post

#include <ios>
#include <istream>
#include <limits>

void ignore_line ( std::istream& in )
{
  in.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );
}

With that, all you have to do is call the function ignore_line(cin);

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

Well, what is wrong with the code you posted? Compiler errors/warnings? If yes, what are they?

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

>>getline(cin, partDescrip);
That should work ok assuming partDescrip is std::string. Why the program skips it is due to other parts of your program. If you have input for integers then you need to clean out the input keyboard buffer of the '\n' that is left. Right after the input integer add cin.ignore('\n'); , or for a more detailed explaination see Narue's thread here.

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

your program does not allocate any memory for the line. And your program does way too much work! This is all that is needed.

std::string line;
int i = 0;
while( i < 7 && getline(inputfile, line) )
{
    i++;
}
cout << line << "\n";
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I know many people mistakenly believe evolution is a fact while its actually nothing more than just a good (ok very good) theory. There is no way to prove evolution, just as there is no way to prove creationism. We can believe all we want but that doesn't make it fact. We can test short evolution durations, say between two or three generations or so but there is no way to show how (or if) one species evolves into an entirely different species.

I'm not arguing that evolution doesn't exit -- only that it isn't a proven fact.

Creationism, on the otherhand, is on an even shaker grounds than evolution. Its not even possible to create a theory about intelligent creation. I do think there was intelligent design when creating the universe. Something, or someone, had to create the universe -- it didn't just happen out of nothing. Even if you believe the Big Bang theory, someone had to create that mass that exploded.

My though is that the Bible correctly tells us who created the universe, but what it doesn't tell us is how it was created. We will never know the true answer to that, but it probably started with the Big Bang. When the Earth cooled down enough to support life then evolution took hold, and over a few billion years we humans evolved into what we are today.

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

You don't have to use chdir() because in the code snippet I posted the function parameter is the full path to the directory. Here's one way to do it (in C, not C++)

Note: I did not compile or test the program below.

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>

using namespace std;

int seekdir(char* path, int depth)
{
    static int count = 0;
    DIR* dir;
    count++;
    dir = opendir(path.c_str());
    if(dir == 0)
    {
        cout << "Can not open directory '" << path << "'\n";
        return 1;
    }
    struct dirent *d;
    while( (d = readdir(dir)) != 0)
    {
        if( d->d_type == DT_DIR && strcmp(d->d_name,".") != 0 &&
                strcmp(d->d_name,"..") != 0)
       {
            char* p = malloc(255);
            strcpy(p,path);
            strcat(p,"/");
            strcat(p,d->d_name);
            seekdir(p);	
            free(p);	
        }
        else if(count == depth && d->d_type == DT_REG)
        {
             printf("%s\n",d->d_name);
        }

    }
    closedir(dir);	
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>but i got it by myself
Great job :) Now you will easily remember that the next time you encounter that problem.

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

lines 1, 10, 15, 23, 31, 50, 71, 95 and 100 are comments. So how is that related to the subject of this thread ?

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

depends on how fancy you want the print job. Here's one solution that does not require MFC. That site has other c++ classes so just put "printer" in their search bar.

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

First you will have to change the DLL to accept the parameters that you want. That means you will have to recompile the dll with the new set of parameters.

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

Its better to not write assembly language at all -- just let the compiler do the work for you. There is little, if anything, to be gained by hard-coding assembly language into a c++ program. And it makes porting to other operating systems next to impossible.

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

how is accountNumber declared?

delete line 12 because the previous loop copies the null terminator into the array.

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

. But this is a problem that is incredibly rare on modern machines - and running out of memory (not being able to allocate any) would ultimately lead to system issues much bigger than your program executing :P

You are right about that -- the entire computer would just crash and die if that ever happened. For that reason I don't check for allocation failure any more. It was necessary 15 years ago under MS-DOS 6.X and earlier, but not today. Program runs the computer out of memory -- just toss more memory at it :) But that would normally indicate a huge memory leak that needs to be fixed.

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

You need to post the Queue class, especiall the enqueue() method. My hunch is that it does not make its own copy of the Customer class, but just uses the same pointer that is passed to it in the parameter. That's why it would wind up with all queue nodes pointing to the same Customer object.

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

By giving incentives to the father of the child to marry the mother.

You are just blowing smoke. Why would you want a child raised by two people to hate each other? Its often better for the child to be raised by a single parent. The days of The Brady Bunch are long over.

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

>>She will bring back family values.
I know she means well, but that won't happen. Politicians have been saying that for years and years, yet our nation's family values has continued to go down the toilet.

>>Make sure that every child has a father.
How is she going to do that??? Of course every child has a father -- I don't think its yet possible for a woman to make a baby by herself and without the help of some man.

>> She will not take away our guns.
Neither will Obama.

>>She is pro Christianity.
That's ok, but would you discount her if she is Jewish?

>>She supports the all important creation approach.
That just shows she's illogical.

>> She will ban witchcraft.
Impossible -- the constitution guarentees everyone's right to religion

>> She will not tax away your wealth.
Ha Ha. She won't have to because the stock market is going to do it for her.

>> Enemies of the US better be worried.
Ohhhhhhh!

>> Countries that are not with us will suffer.
That's a rediculous statement.

>> She will get and kill Osama.
She's not the President, so she will do no such thing

>> She will make hockey the true American sport it is.
Yea!!! :) :)

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

Dude -- I should give you bad rep for wasting so much of my time :)

William Hemsworth commented: He warned you in the thread title :icon_cheesygrin: +4