SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

cow compare strings (ccostring)

        (C) 07-05-2000 2000 Jeppe Sorensen
                cowhead@post10.tele.dk
                I am on #Linux.dk@undernet

ABOUT

        This is my first c++ program I have write in Linux
        which I have finish. Normally I begin on a other program
        before I have finish the first program. 
        
        cow compare strings, as I call it, compare to lines from to 
        difference files, but it compares not the hole line. 
        
        ccostring start from the begin of the line ( line(1) ) and read to the first '-' in 
        the line. Then it do the same with the other line ( line(2) ). After that it compare 
        the to strings, if the are equal it print the line, else it read to the next '-' in 
        the line(2) and compare them. If it finders nothing, it read to the next '-' in line(1)
        and start over with line(2). If nothings was found it print nothing.

A example

        line(1) = "Karl Martin - Sitting here.mp3"       from Input file
        line(2) = "Lene Martin - Sitting down here.mp3"  from Datebase file
        ccostring read to the first '-' in line(1) and put into (char) line1[20]
        but it doesn't put ' ' into line1[20] so line1[20] will look like this
        
        line1[20] = "KarlMartin"
        Then it read to first '-' in line(2) and put into (char) line1[20]
        but it doesn't put ' ' into line2[20] so line2[20] will look like this
        
        line2[20] = "LeneMartin"
        Then we compare the two arrays, but the are not equal, so we read to the next '-' in line(2)
        It stops when it meat a '.' so line2[20] will now look like this
        
        line2[20] = "Sittingdownhere"
        Then we compare the two arrays again, but the are still not equal and it was the last word in 
        line(2) so we read to the next '-' in line1 and put into line1[20], It also stop when it meat a '.'
        
        line1[20] = "Sittinghere"
        Then we start over with line(2), when it's don, ccostring read the next line i Database fil and 
        put into line(2).
        
        line(2) = "Karl Martin - Drive buy.mp3"         Nr. 2 line in Database file

Start over Read to '-' in line(1) and line(2) and put it into line1[20] and line2[20]

        line1[20] = "KarlMartin"
        line2[20] = "KarlMartin"
        Then we compare the two arrays and the are equal so we return 1 (true) and ccostring print it out
        and we read the next line in the Database fil. When we meat EOF in the datefile, we read the next 
        line in the Input fil. And start over
        
        line(1) = "Aqua - Around the world.mp3"
        LICENSE
        -------
        ccostring is under GPL, 
        
        More information http://www.gnu.org/copyleft/copyleft.html for 
         
        ccostring is free and its free to copy the code, but
        I will be happy if you mailed me if you use some of my code.
        If you make the code faster or better please mail me
        
        Download
        --------
        
        Newest version
        
        http://home10.inet.tele.dk/eliterev/ccostring/ccostring-28042000.tar.gz
        Install
        -------
        
        You have to be root to install the program
        
        [cowhead@cowhead]$ su

Then trip make to compile the scoure code

[cowhead@cowhead]$ make

Use make install to install the binary

[cowhead@cowhead]$ make install

        If nothing goes wrong, you ccostring successful installed on you system
        Now you can call ccostring use ccostring -h for help
        
        [cowhead@cowhead]$ ccostring -h
        Install by manually
        -------------------
        
        Compile the scoure
        
        [cowhead@cowhead]$ g++ -o ccostring main.cpp -O2 -Wall -g

Copy or move the binary to you home bin dir

[cowhead@cowhead]$ cp ./ccostring ~/.bin or mv ./ccostring ~/.bin

Now you ready to run ccostring

[cowhead@cowhead]$ ccostring -h

        BUGS
        ----
        With out the -c option it print all out in uppercase
        I am working on this bug
        CONTACT
        -------
        If you find some bug pleas mail me  cowhead@post10.tele.dk
        
        Newest version avaiable on (I have not make the homepage yet  17-04-2000 )
            http://home10.inet.tele.dk/eliterev/ccostring.html


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.