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

why don't you compile it and see for yourself what the answer is.

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

For a beginner, yes it was a waste.

>> "waw" in arabic means " what u did was"
Not many of us (probably nobody) speaks arabic here, which is a very good reason not to post such things.

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

See line 32. You previously asked for the input filename but hardcoded it at line 32. Also check the file system to see that its in the current working directory (where the *.exe program runs). If not then you have to specify the full path on line 32. Finally, if the file name contains spaces, such as Program Files then line 27 won't work -- you have to use getline() in that case.

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

Plonk

>>waw man ur a great guy
Oh! Narue when did you have a sex change :)

And what is waw

WAW or Waw can mean:

Watch and wait
the letter Waw in the Hebrew, Arabic and other (mostly Semitic) alphabets
IATA code for Warsaw Frederic Chopin Airport
WAW (Australian television station), a satellite broadcast TV station for Western Australia
an alternate transliteration of Wau, Sudan
World Association of Wrestling a British professional wrestling promotion
World at War
Write after write data hazard
WAW Velomobile
Wired All Wrong
WAW is also the callsign for Golden West Network.
WAW is also the abbreviation for the law firm of Wharton Aldhizer and Weaver located in Harrisonburg, Virginia or on the web at http://www.WAWLAW.com.

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

I think I'm still confused about what you want. According to your original post you have three files that contain portions of the one large file (exampleFile.txt). Each section of exampleFile.txt is separated by a line that begings with the text telemetre_.

What are the file names ? Are the names the same as the first section line ? such as telemetre_18_04_2007_11h_23_mn_15sec.dbt ? And you want to compare all the lines in that file with the lines that follow in exampleFile.txt ?

To do that then I think you need to do something a little more complex than what you have posted. It isn't necessary to read exampleFile.txt into memory all at one time. Instead, read it one line at a time. If the line just read is a filename, then open that file and get ready to compare all the lines in exampleFile.txt until another filename is reached.

open exampleFile.txt
while not at end-of-file
    do we have a filename ?
         yes, then open second file
   otherwise
        read a line from second file and compare it with
        the line just read from exampleFile.txt.  If they are
        the same then continue the file loop and read another
        line from exampleFile.txt.  If however they are not the
        same you have to do something (issue a warning or
        do something else)
end of while
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>at this line if line='\n' do nothing only read lines 1 to 7
Look at your code again because that is not what it says. The loop from lines 9 thru 14 do not read anything from the file because the previous loop has read it all. All the loop in lines 9-14 is doing is iterating through an array that's already in memory. So you need to just delete line 11 because it can cause an infinit loop that will crash your program.

If you just want to write lines 8-end-of-file to the output file then just start the loop that begins on line 8 with 8 instead of 0

for(int i = 8; i <arrayL.size() ; i++)
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I wanted to add that a person's soul is formed from memories. Just my romantic notion.

And your proof? You might be right but nobody knows if a soul even exists let alone what it is. But that's a topic for a different thread.

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

It is true that the limit to our learning is probably our life span

We don't really know whether its infinit or finite because nobody has ever even approached the theoritical limit and there's no way to scientifically test it that I know of (that really does't mean shit because I'm not a scientist). And yes, of course its limited to our life span, unless dead people continue to learn :) (hey! in St Louis they can vote, so why not?)

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

while compiling it shows this type of error

"Nonportable pointer conversion"

You're right -- I didn't read it hard enough. Should use single quotes, not double quotes, like this: for(code = 'A';code <= 'Z'; code += 1)

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

>> Now i would like this data save to a .txt file.
Just use normal file i/o. If you wrote the code you posted then that should not be a problem for you. On the otherhand if you didn't write it then see fopen(), fprintf() and fclose() functions.

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

What are you tring to do at line 11? With that semicolon at the end that line does nothing.

>>How can i do to read lines 8 to End of my file this code is only for line 1 to 7 :

Looks like it reads the whole file to me. If you want to skip the first 7 lines then just don't add them to the array -- its not possible to just skip them.

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

Quite simple -- first make sure you compile your program for DEBUG. Then use the functions in the Debug menu. You will use Start Debugging (F5), Step Into (F11) and Step Over (F12) the most. You can save some time by setting breakpoints so that the debugger will stop on the line you set.

It make take a bit to learn the debugger but after that find problems in the code becomes fairly easy.

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

>>function takes 0 arguments
What line number? Pay close attention to the parameters of the function prototypes at the top of the program and the parameters (or lack of parameters) passed in lines 44 thru 50 of your program.

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

what is the output of your program? The code looks ok, except I'd make code an int instead of char but that shouldn't cause any problem.

The format string needs a '\n' for line feed ("%c, %d\n",

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

Without knowing the values of the variables its quite impossible to determine the solution to your problem. What compiler and os are you using? You need to learn how to use your compiler's debugger so that you can single-step through the program execution and see that the variable's values are.

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

yes. Pass the number you want evaluated as a parameter to the function.

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

The function should be declared to return bool. If the value is even then return true otherwise return false.

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

If USA is such a terrible country why is it that so many people try to get here? We have to make getting citizenship and green cards difficult because we don't have room to accommodate everyone on earth. We must take the Me First attitude in this case.

TheNNS commented: you don't have to give me bad rep just because you disagree with me. -1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> am not able to do that
Yup -- you found out the hard way that it can't be done. One solution is to write the variables to a file or shared memory so that other programs can read them.

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

>>will like someone to quickly give me a hint on how to use the mfc classes
Ha Ha Ha. Here are some tutorials

>>what i need to know. i wont mind how long it takes if you are willing to help
Average learning curve is about one year.

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

program A calls program B. Program B writes some stuff to a file and program A reads it. Or you could use pipes (see man pages for popen() )

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

First, don't use scanf() because it won't take anything beyond the first space you type, consequently you can not enter a file name that includes spaces. You need to use fgets() for that. Next, you have to concantinate the two strings together.

char filename[260]; // max allows in MS-Windows path + filename
strcpy(filename,"c:/");
fgets(&filename[3], 257,stdin);
// now strip off the newline 
if( filename[strlen(filename)-1) == '\n')
    filename[strlen(filename)-1) = 0;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I did not get any errors with the code you posted. What compiler and os are you using?

line 35: never ever use gets() for anything because it can corrupt the memory of your program. If you type something that is longer than the destination buffer can hold, gets() will just scribble the remaining characters into all adjucent memory. You should use fgets() instead, like this: fgets((*ptr_s).cpu_type, sizeof((*ptr_s).cpu_type), stdin);

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

CFile is often used with CArchive to serialize MFC classes and objects. Otherwise its not a very good class for normal text file i/o.

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

Never smoked or smelled pot, so I have no idea what it smells like. But I do like the smell of a good old fashioned bond fire or a fireplace. Some flavors of pipe smoke are good too, but you have to be the smeller and not the smoker in order to enjoy the aroma.

EnderX commented: ("bond fire" == bonfire)? +3
Ene Uran commented: Imformative post +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Its a pain to set up express to use the plaform sdk

Yes, but the instructions are pretty clear, if you follow them closely you should not experience any problems.

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

you need another counter that keeps track of where in the line the cursor is located and increment or decrement it at the same time that you change the col counter.

Also, when moving the left arrow you need to check that col is greater than zero to prevent negative values. And same with the counter I mentioned above.

>>I'm using Microsoft Visual C++ 6.0.
Unless you have to use it for school you should just trash that compiler and get VC++ 2005 Express (and the current Windows SDK). VC++ 6.0 is a very old compiler which does not conform to C++ standards very well.

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

One huge problem is pointer b only points to a one-byte empty string which can not be expanded. Since you want a string of 8 characters then you have to allocate memory for it something like this char b[9] = {0}; . That will allocate memory for 8 characters plus a null terminator, and initialize all of them with 0.

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

Maybe those islands just simply sank. Isn't that's what is happening to Venice.

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

You humans ....

And what are you ? Some sort of alien from a galaxy far far away ? Yes, most people agree global warming is real. The dispute is whether mankind is helping it along or is it just a natural and recurring occurence. Golbal warming would be occuring even if there were no humans alive right now. We are living in a very calm time in Earth's history and it could change for the worse very quickly and without much notice. There is not a thing we can do about it.

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

You did not null-terminate the string. After line 102 (end of the loop) add this: currentline->character[col] = 0; Or, even easier, use a std::string object for file input and getline() to read every line in the file. If you do that then you don't need to read the file one character at a time or worry about the '\n' character because getline() will do that for you.

std::string reading;
while( getline(instream, reading) )
{
     strcpy( currentline->character, reading.c_str());
}

What is readfile on line 59 supposed to do? Did you name that function correctly? As currently written all it does is diaplay the text that was read from main().

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

What kind of an object is ListViewTextItem?

The second argument to fprintf() is a char*, not a c++ class. fprintf() doesn't know a thing about c++ or objects.

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

That's what happens when you jump the gun and dive right into the middle of a program. Its sort of like trying to fly a 747 jet airplain after about 4 hours flying time in a Cessna twin engine prop. You might learn to fly it after crash landing several times.

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

line 30 of the header file needs a semicolon

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

My guess is that you need to add a constructor which initialized all the pointers to NULL. As it is those pointers are uninitialized and point to some random place in memory and any linked list using them will fail

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

you can make CAnimate a pointer

class CPlanet
{
 ...
   CAnimate* m_animateptr;
};

int main()
{
    CPlanet planet;
    planet->m_animateptr = new CAnimate;
}

But you should probably put the code in CPlanet to make it allocate all necessary memory for itself

class CPlanet
{
public:
    CPlanet(bool bNeedAnimate = true)
    {
        if( bNeedAnimate)
            m_animateptr = new CAnimate;
        else
            m_animateptr = NULL;
    }
 ...
   CAnimate* m_animateptr;
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I was wondeing if somebody could comment them to help me understand them better.
Comment it yourself and you will understand it even more.

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

That makes absolutely no sense whatsoever.

I thought he was just trying to be a little sarcastic with that statement. Two :) :) for it.

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

>>fgets( str[y], sizeof str[y] / sizeof ( char ), stdin );
The division is unnecessary because sizeof(char) is guarenteed to always be 1. So it can be reduced to this: fgets( str[y], sizeof str[y], stdin ); .

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

Non-privileged mode operating systems are probably just too small to accommidate all the code needed to protect the hardware from damaging programs. For example MS-DOS 6.X and earlier were already limited to using 640K of memory, and that had to include the operating system and all TSRs, which left most application programs just 450K or so RAM. Now add code to the os to prptect the hardware and there would be little, if any, RAM left.

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

You mean remove it from CPlanet? or leave it there and instantiate another instance of it in main(). I assume the purpose of CAnimation is to make the class rotate on its axis, so removing it from CPlanet would not be a very good idea. If you instantiated an instance of CAnimation directly in main() what would it do? What is it supposed to animate ?

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

What I am saying is that a neuron takes up physical space, and I have yet to see any human running around with an infinite size head.

I've known a couple people who thought that was true :)

What you learn has to be stored somewhere, generally this is a collection of neurons. Alcoholics and heavy smokers who destroy large amounts of their brain's neurons lose the ability to learn.

I was never an alcoholic but was a heavy smoker for many years and have found it difficult to learn but not impossible, afterall we don't walk around like zombies :) I just have to work at it harder and longer.

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

Look up the % operator to get the individual digits of each value so you can add them up. There are many threads here that show how to do this. Search for modulus operator.

Clarify: only needed when input is an integer, not a string. With integer input you can not enter the format "dd-mm-yyyy" because it won't accept the hyphens. You have to use string input for that.

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

No, that logic is not flawed.. I'm saying that a human just concentrate his entire mind on one subject. I'm not saying he can't learn anything else.. I'm saying ASSUME he only learned one subject his entire life.. thus, my argument does hold up.

You can ASSUME the Earth is flat too, but that doesn't make it so. you can ASSUME anything you want.

Huh? I thought we were arguing whether or not humans could learn an infinite amount of knowledge.. which is false. However, it appears that you are trying to make the point that humans can potentially learn an infinite array of different things.. which is true.

You are confused again. Re-read my statement. Just because a human can learn an infinite amount of knowledge doesn't necessarily mean he can learn all the knowledge there is to learn. At least I don't think that's a contridiction.

Actually, we are both just talking nonsense because neither of us is in a position to prove or disprove our statements. Its not possible to provie it one way or the other, very similar to debating whether the Big Bang theory is right or wrong. But non-the-less its an interesting topic.

I mentioned 10% b/c it is a common misconception.. If you will re-read my post you will find that I said scientists believe we actually use the majority of our brains.

I think that's where Nichito got confused.

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

so, if it _is_ infinite, just how much is it 10% of infinity?

Good question -- Josh made the reference to 10%, not me. I only said we only use a small amount of our minds (not because I have any scientific research of my own but that's the rhumor I've heard scientists tell us).

Current thought is that statement is false. We do actually use most, if not all of our brains, maybe not all at the same time, but there seems to be no unused portions. That bit of triva, however, has no bearing on how much or little we are capable of learning.

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

Infinite capacity to produce neurons? The same is true for many other things, including producing blood.. The overall total neurons has absolutely nothing to do with acquiring knowledge..

I tend to agree. It was Lardmeister who claimed there was that relationship.

Now on to the limit of knowledge... how does my example not show a definite limit in the acquisition of knowledge?? As I said in my example, suppose an individual attends school for the rest of his life just to learn the amount of knowledge that we have so far acquired in a specific field.. if that is true, then he has no time to come up with new ideas/concepts.

That logic is flawed because it doesn't take into account the ability for the human mind to multi-task and multi-thread. Many people can do many things at the same time, such as play the pinao while talking on the cell phone. No one can concentrate on one thing so hard that he/she can not do something else too at the same time.

Time is our biggest problem.. We will not live forever.. our race will one day cease to exist.. thus, we can not acquire an infinite amount of knowledge in a finite amount of time.

No argument there because that isn't the point of the discussion. The point is that there is no limit to what the human mind can learn. It isn't like a glass of water which can only hold a finite amount of a …

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

Did you bother to read the Read Me links at the top of this board? I thnk there are links to free compilers.

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

Enter the date using a std::string object

#include <string> 
...
int main()
{
    std::string date;
    cin >> date;
   ...
}

now just use the isnumeric() macro to see if the digit is a digit or not. If a digit subtract '0' from the digit and add the int result to an accumulator, much like finding the sum of any string of integers. You don't need that switch statement at all -- just do it in a loop, and you should be able to code it in less than 5 lines or so.

Validating the string is a little more complicated. You have to split it up into its individual parts -- mm dd and yyyy -- then validate the integers somthing like what you already posted.

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

In other words, brute force. Outputting a bunch of newlines '\n' is the only portable way.

And that isn't portable either because there is no standard way to determine how many line to clear.