Here are my instructions and I think I have it done but I just realized I need to use memory mapped IO. I am reading over the book and doing research on it but just dont know how to change it and my deadline is Friday. Can someone take a look at this? I will provide the instructions and what I have...(fyi if you dont want to read my instructions you don't have to just want to make it as easy as possible to understand what I am doing)

Create a utility that transfers words that are palindromes in the input file into the output file. Place a space between each palindrome written to the output file.
The input path and file name and the output path and file name must be gathered at runtime from the user. This can be accomplished via command line inputs (see argv and argc parameters in the main() function).
The program must use memory-mapped file input/output.
The contents of the input file must not be changed by your program (read only).
The definition of a palindrome, for purposes of this programming assignment, is a word which reads the same backward or forward. Examples of palindromes are mom, pop, kayak, noon, radar, and racecar.
While there are a number of methods available to test to see if a word is a palindrome, the most common method is to use a stack. Character[0] of the original string can be compared with character[n-1]. The next comparison would address character[1] with character[n-2]. Comparison continues until all characters are compared (the stack is empty) or there is an inequality (the word is not a palindrome).
The output file should contain only those words that are palindromes from the input file. Each word in the output file should be separated by a space.
Since the length of the output file is determined at runtime, and there is no way to predict how many palindromes will be present in the input file (without actually performing the test), there is no means to accurately predict the output file size required. Set the output file size to the input file size.
You may use the Windows Platform SDK (Win32), the Active Template Library (ATL), and the Standard Template Library (STL). You may use a managed or unmanaged project.
You should turn in a copy of your source files on floppy

Here is my code...

#include<iostream>

#include <fstream>

#include<string>

using namespace std;



//FUNCTIONS

bool isPalindrome(string);



//begin int main

int main(int argc, char * argv[])

{

    //Declare variables

    ifstream in;

    ofstream out;

    bool palin;

    string data;



    //open the file

    in.open(argv[1]);



    //Statement if the file does not open

    if(in.fail())          

       {

           //Cout statement to show the error

            cout<<"File not opening!" << endl;



            //Make a pause

            system("pause");

        

            //Return a value

            return 1;

        }



    //Open the file

    out.open(argv[2]);

    in>>data;



    //Perform while statement

    while(in)

    {

        palin=isPalindrome(data);

        if(palin)



        out<<data<<" ";

        in>>data;

    }



    //Close the in

    in.close();



    //Close the out

    out.close();

}



//Function to check Palindrome

bool isPalindrome(string input)

{

    //Declare variables

    int i=0,j;

    bool y=false;



    j=input.length()-1;



    //While statment to check i and j

    while(input[i]==input[j]&&i<=j)

    {

        i++;

        j--;

    }



    //If statement to check if i > j

    if(i>j)



    //Show that y is true

    y=true;



    //Return y

    return y;

}

anyone have any ideas as I am completely lost on this?

Which library are you using for memory-mapped file? If you use Unix, you could look at here. If you are using Windows, you could check here. It depends on your choice.

PS: Your code comment is not really what they call comments. You may need to read how to make a comment later when you have time. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.