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

See line 11: you changed the declaration of filenames from an array of pointers to a simple pointer that is no longer an array. Change it back the way it was in your original post. You also have to change line 21 to use the array index.

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

>>When I tried this, I got two warnings:
>>1. assignment makes integer from pointer without cast
>>2. passing arg 1 of 'strcpy' makes pointer from integer without cast

Post code because what I posted is correct.

>>I have it starting at 2 because I only need the filenames, not the '.' and the '..'
Oh I see. You are correct. Normally we would not put them in the list.

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

i is a counter that is used to index or iterate throug the array. On each loop iteration the value of i is incremented by one so that the program is referencing the next character in the string. See this table for how I got the values of k.

i      u[i]      k
0     ' '         32 // ascii decimal value of a space
1     U           85
2     n          110
3     i          105
...

If I were writing that code snipped I would have simplified it like this, which does not use k at all.

for(i=0;  u[i] != 0; i++) // Read-dynamic way
{
      while(ASC0_ubTxBufFree() == 0) {} //wait untill buffer is not busy
      ASC0_vSendData( u[i] ); //send Data

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

This was a study of students in 5th, 6th and 7th grades showed that girls had significantly higher grades in math than boys. But they attribute the differences to girls approached studying better than boys -- boys are more interested in disruptive behavor (boys will be boys) while girls tend to take education more seriously.

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

>> was sure that was the point of the preprocessor directives #ifndef etc
Nope, has nothing at all to do with that. Those directives are useful when a header file is include multiple times, which is often the case when including system header files.

// header1.h
#include <stdio.h>
...
<other stuff here>
// main.cpp
#include <header1.h>
#include <stdio.h>
...

Now when the above main.cpp is compiled it includes header1.h and stdio.h. Without the code guard tags that are in stdio.h that would result in tons of errors because of duplicate declarations when main.cpp includes stdio.h.

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

The function appears to be sending some characters someplace, such as across a socket or serial port.

>>what does it do exactly with the string(z=p)?
I don't see that in your post

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

line 22 in the drawscr.h is causing the problem because that header file is included in both *.cpp files. That line is actually declaring a pointer named message. To correct this remove the declaration of message from line 22 and declare it as extern extern strucvt MsgStock* message; . Then in ONE of the *.cpp files declare it again but this time WITHOUT the extern keyword.

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

Glad to have helped.

AD

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

line 97: >>while (checkPlayed (guess));
It gets suck here sometimes. In my testing it was after I entered the 3d number. Very probably because of that semicolon at the end of the line.

[edit]See now, if you had learned to use your compiler's debugger you could have found this error two weeks ago. It took me all of about 10 minutes to find the problem.[/edit]

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

yes, I continued and after the 3d entry it stopped. I'm going to run the debugger to see what is causing it, my guess is the program is trashing memory.

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

Every MS-Windows program (per-module bases) has an HINSTANCE value. Its like a numerical ID that the operating system uses to keep track of the processes (programs) that are running. That's all it means. If you are playing two different games on your MS-Windows computer each instance of each game will have its own unique HINSTANCE value.

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

I compiled with VC++ 2005 Express and it ran ok. Here is the output

Tic Tac Toe
1 | 2 | 3
- - - - - -
4 | 5 | 6
- - - - - -
7 | 8 | 9

Human:1
x | |
- - - - - -
| |
- - - - - -
| |

Computer: 9
x | |
- - - - - -
| |
- - - - - -
| | o

c= 2
Human:

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

My guess is that you are not linking with the fox libraries. I tried to download it but only got errors that page cannot be displayed.

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

>>What is pre-module basis
The HINSTANCE is used to identify a specific process (program that is running). Program A will have a different value of HINSTANCE than program B. Or that's the way its supposed to work.

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

line 69: getSSN is not a function. Look it in the class declaration -- you forgot to add the () parentheses so all you have there is a pointer. Same with getSalary().

line 114: yearsEmployed does not exist. Check the spelling.

Now look at the remaining errors one at a time, then see if you can find what's wrong. After correcting it recompile to remove residual errors that were caused by the error you just corrected. With a little practice you will learn what those error messages mean and how to correct them.

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

>>filenames = (char *) malloc(sizeof *filenames);

That solves nothing. what is sizeof(*filenames) ?? Answer: number of bytes allocated to the array, not the number of bytes needed to copy d_name into the array. Here is what it should be: Note that you have to use the i counter because filenames is an array of pointers. And, in C language, you do not have to typecase the return value of malloc. Required in c++, but not in C.

filenames[ i ] =  malloc(strlen(dir->d_name)+1);
strcpy(filenames[i],dir->d_name);

line 33: >> for (a = 2; a < i; a++){
why is that loop starting with 2 instead of 0.

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

>> ch = cin.get(phrase);
the get function doesn't take a parameter

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

the link you posted doesn't go to a tutorial. Did you download the precompiled package or the source code and compile it yourself ?

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

les competiton for me ;)

im determined to exceed dani in post count before the summer

only ~3000 to go

I doubt you can really catch up with her -- all she has to do is double her post count in the database. Afterall, the Queen can do anything :)

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

You can use my site if you wish. It is password protected to avoid risk of being found.

<snip>

Cheers

This is one time I wish I knew how to hijack your web site to that I could trash it. Anyone stupid enough to post the user name and password on any public site diserves the very worst that can happen to his site. I swear that you must have the IQ if a grape.

>>It is password protected to avoid risk of being found
Not any more you numbskull.

Sturm commented: I believe threatening to illegally hack his server is against the Daniweb rules +0
joshSCH commented: It's a proxy server! -2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There was a huge dispute here in St Louis over the past three years because the black fire chief refused to make any promotions based on a required test. Here is the full article.. The fire chief claimed the tests were racially biased. Earlier this year the St Louis mayor demanded the fire chief make promotions, he stood his ground and refused, so the Mayor fired him and promoted a white man to firechief. The new chief started making promotions, and guess what -- all but one of the 30 promotions were white! That tells me that the black fire chief was probably right and the tests were indeed racially biased.

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

To remove punctuation you will normally have to rewrite the entire string to avoid the many problems with modifying string literals passed to the function. Just iterate through the string one character at a time and copy the character to the new string only if it is not a punctuation character.

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

put them in an array then find the max after the loop stops.

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

After reading that link I don't see the point of it. All you have to do is write out the information that you want to a file.

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

I doubt you will get free source code. But you can buy PartitionMagic.

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

Don't know the answer, but is this a c++ question???

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

Same answer as this post

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

Can someone help you ? Yes, but only if you post the code you have written. Will someone write the program for you? No. This is not a software whorehouse.

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

And now back to the original problem: If all you want to do is make a copy of a file you don't need to do all that forking and other stuff. This is a very very basic problem that can be done in a short few lines of code.

Using google to initially research your problem would have saved you four days of wasted time. I will not duplicate the code here because you can easily find it in one of the google links I posted. But be warned that some of the code you find on the net isn't very well written. For example using while( !feof(in) ) is not the recommnended way of coding a loop like that.

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

line 23 needs to call malloc() to allocate memory for the name then call strcpy() to copy the name. Hardcoding the number of filename pointers in your program is ok only if you know in advance the maximum you will need. But what happens to your program if there are 10 filenames in that directory? Or 100 filenames ? In those cases you will want to use a linked list of names.

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

Just replace int array[] with std::string array[] and int my_value with std::string my_value , the rest of that will not change.

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

You need to pass those vectors by reference instead of by value to avoid duplicating the vectors and so that the changes will be available to the calling function vector<int> merge(vector<int>& list1, vector<int>& list2){

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

The problem is that SSN and GRADE have not been declared yet. To fix move lines 24 thru 32 up to just under line 13.

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

If you want to eliminate the lines where the name is duplicated then you will need to read the file into an array so that the program can check if the name has already been read. In c++ the vector class is the most convenient way to create the array. Below is one way to do it

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;

struct student
{
    string sex;
    string grades;
    string name;
};


int main()
{
    vector<student> studentList;
    student stdnt;
    cout << " Sex        Answers                  Name      " << endl;
    cout << " ---     --------------        --------------- " << endl; 
    //string line;
    std::ifstream in("TextFile1.txt"); 

    if(!in)
    {
        std::cout<<"Could not open file\n\n";
        return 1;
    }
    // read the data file into an array of structures
    while( in >> stdnt.sex >> stdnt.grades )
    {
        getline(in, stdnt.name);
        vector<student>::iterator it = studentList.begin();
        bool found = false;
        // search the array for this student
        for( ; it != studentList.end(); it++)
        {
            if( it->name == stdnt.name)
            {
                found = true;
                break;
            }
        }
        // if not int the array, then add it
        if(found == false)
            studentList.push_back(stdnt);
    }
    // all rows in the file are now read, so just output the data
    vector<student>::iterator it = studentList.begin();
    for( ; it != studentList.end(); it++)
    {
        cout.setf(ios::left);
        cout << setw(10) << "  " + it->sex << setw(20) << it->grades << setw(15) << it->name << "\n";
    }

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

line 33: sex[3] does not exist. That array has elements numbered 0, 1 and 2. There is no element 3. And that loop isn't necessary anyway. The array can be initialized to 0 when declared int array[3] = {0}; . Do the same with all the other arrays.

line 32: why? it has no purpose, so just delete it.

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

I tried it with the corrections you suggested and know the program won't read the file or at least it won't cout any of the information.

Post code please -- I live only about 30 miles from you but my eyesight isn't that good :)

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

Post your current code so that we can see what you may have done wrong.

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

>>if (memory.substr(0,4)=="0000")

memory is an array of integers which of course don't have methods.
[edit]^^^ what Shawn said[/edit]

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

Please post a line or two from the data file.

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

>>ofstream* rgpostrm [BASE_LAYER];
Why do you need to many streams? And why allocate them ?

>>What it says for ios::binary | ios:out and ios:out | ios::binary
There is no difference between the two. Its like asking what's the difference between 2 times 3 and 3 times 2.

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

>>Can anyone get me started with this??
Yes

int main()
{
   // your code goes here
}

How much do you know about the assignment you were given ? Everything that's in your assignment should be covered somewhere in your textbook.

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

All of the sections are optional, so we sometimes end up with this: for(;;)

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

(1) The language specification requires them. (2) they separate initialization, condition, and increment statements.

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

hahaha.. oh blud, you crack me up. The point of my putting that damn disclaimer was so that people wouldn't call me '..an un-educated..'. I was not 'gloating' at all. But seriously, if you wish to attack me.. why not actually attack my post? Come back when you can actually debate the material at hand :P

That was actually the reason for my original post -- you were gloating. Maybe you didn't realize it, but that's the way you came across to me and apparently at least one other person. Your original post would have been better had you not posted that disclaimer.

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

So I guess you dislike logic and statistics...
.

No, but there is a place for everything. For example I can prove statically that women become pregnant when the moon rises. I suppose it is true that that is time time of day that women normally become pregnant but the moon is not the cause of pregnancy. We can make statistics tell anything we want. I could probably also prove statistically that your intelligence is in the lowest 10% of most men -- if I choose the sample of 100 men whose IQ is 135 or above and claim that sample is a statistical representation of all men in the world.

This well-known saying is part of a phrase attributed to Benjamin Disraeli and popularized in the U.S. by Mark Twain: There are three kinds of lies: lies, damned lies, and statistics

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

Looks ok to me. What compiler and what is the error message?

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

The input line can be split using stringstream class

#include <sstream>
...
...
stringstream stream(line);
stream >> firstName >> lastName >> employeeID;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your program has some mismatched { and } bracket. Proper code alignment should show these up right away. The function at line 150 has this problem.

line 43 is syntax error. You did not specify a parameter for the time() function.

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

>>Do you consider the quote below racist?
Yes I do.

and this statement too
>>They [blacks] typically do worse than white people in education, and so they psychologically tell themselves that education is not important

The above also applies to the differences between males and females -- I heard on the talk radio just the other day that women are more successful in college then men, there are more women graduates and their GPA is higher. So does that mean men have a lower IQ than women or could the differences be for other factors ? My uneducated guess is other factors.

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

one purpose of pointers to to allocate an array of something because the size is not known until the program is run. Employee* empArray = new Employee[NumberEmployees]; Another purpose: creating a linked list of Employee classes. Admittedly most c++ programmers would using c++ container classes such as vector or dqueue.