Thread: How to link c++ code with Ms Access

  1. #1
    Registered User
    Join Date
    Nov 2012
    Location
    Wah, Pakistan, Pakistan
    Posts
    2

    Exclamation How to link c++ code with Ms Access

    dear all,
    I have done a simple c++ program in witch I compared two same files but one file contains the text with no error and other file contains spelling error in it. I print their differences in another file.....

    Now i want the same thing in Microsoft access using the following code. I really don;t know how to connect this code with MS access

    Please please please help me step by step to complete this assignment before 18,December 2012.

    Here is code that i am using to check the differences between two files.

    Code:
    //checks the Difference between two files
    #include <iostream.h>
    #include <conio.h>
    #include <string.h>
    #include <fstream.h>
    
    int main()
    {
        char str_1[36];
        char str_2[36];
        char ch_1, ch_2;
        int i=0;
        clrscr();
        ifstream file_1 ,file_2;
        ofstream file_3;
        file_1.open("file_1.txt", ios::in);
        file_2.open("file_2.txt", ios::in);
        file_3.open("file_3.txt", ios::out);
    
        //The difference will be shown in these Parentheses
    
        file_3 << "\t\t\"{}\": Change Text\n";
        file_3<< "\t\t\"[]\": Original Text\n\n";
    
         //go to the end of the file
    
        while(!file_1.eof())
        {
            file_1.getline(str_1,35);
            file_2.getline(str_2, 35);
            ch_1 = str_1[i];
            ch_2 = str_2[i];
            // If the line of file2 ends but the line of file1 is not ended then print the renaming character in file3
            if(file_2.eof() && !file_1.eof())
            {
                while(!file_1.eof())
                {
                    file_3 << str_1<<"\n";
                    file_1.getline(str_1,35);
                }
                cout<<"\n\n\n\n \t\t........Comparison has been completed....... :)\n\n\n\n Open file_3 to check the changes.. THANK YOU  :P";
                getch();
                return 0;
    
            }
            // If both the lines are equal then simply checks their differences
    
            while(ch_1 != '\0')
            {
                if(ch_1 == ch_2)
                          file_3 << ch_1;
                else
                {
                    file_3 << "{" << ch_1 << "}" << "[" << ch_2 << "]" ;
                }
                ch_1 = str_1[++i];
                ch_2 = str_2[i];
            }
    
            file_3 <<"\n \n ";
            i=0;
    
        }
    
        // If the line of file1 ends but the line of file2 is not ended then print the renaming character in file3
    
        while(!file_2.eof())
        {
    
            file_3 << str_2 << "\n";
            file_2.getline(str_2 , 35);
        }
        file_2.close();
        file_1.close();
        file_3.close();
        cout<<"\n\n\n\n \t\t........Comparison has been completed....... :)\n\n\n\n Open file_3 to check the changes.. THANK YOU  :P";
        getch();
        return 0;
    }
    .

    Regards.
    Mustanser Iqbal

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Maybe you should just export the tables in the MS Access file to say, CSV format, then use your existing program to perform the file differencing.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2012
    Location
    Wah, Pakistan, Pakistan
    Posts
    2

    Unhappy

    Quote Originally Posted by laserlight View Post
    Maybe you should just export the tables in the MS Access file to say, CSV format, then use your existing program to perform the file differencing.
    Thanks brother for information but the thing is i have no idea how to relate this code with ms access..... can you please help me with few steps?????

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. link list build: memory access denied
    By sed_y in forum C++ Programming
    Replies: 5
    Last Post: 07-25-2011, 07:17 PM
  2. a link list code question..
    By transgalactic2 in forum C Programming
    Replies: 29
    Last Post: 10-27-2008, 03:24 PM
  3. Complie and link C++ code in C
    By Micko in forum C++ Programming
    Replies: 9
    Last Post: 02-27-2008, 07:38 AM
  4. Code to link a buttom to a new page
    By hpteenagewizkid in forum C# Programming
    Replies: 0
    Last Post: 04-25-2007, 12:39 PM
  5. Help me ! Link list code in OOP C++
    By phoenix2007 in forum C++ Programming
    Replies: 14
    Last Post: 01-16-2007, 04:48 PM

Tags for this Thread