Programming Wiki: Reading a file into a string

Programming Wiki : CppFileIO

WikiHomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2006-04-02 00:41:23 by ScottRippee

Additions:

Reading a file into a string

istream iterator


Deletions:

Reading a file into a string

istream iterator"





Edited on 2006-04-02 00:19:25 by ScottRippee

Additions:
Techniques for:

Reading a file into a string

istream iterator"
ifstream InFile( "detlog.txt" );
if( !InFile ) {
cerr
"Couldnīt open input file"
endl;
}
create reader objects
istream_iterator<string> DataBegin( InFile );
istream_iterator<string> DataEnd;
Now you can iterate using these istream_iterators and append their values to
a string for example:
while( DataBegin != DataEnd ) {
m_strFileData += *DataBegin;
DataBegin;
}
while getline:
#include <fstream>
#include <iostream>
#include <string>
read contents of file "bla" into buf, discarding newlines
int main(int argc, char* argv[]) {
std::string buf;
std::string line;
std::ifstream in("bla");
while(std::getline(in,line))
buf += line;
std::cout
"read: "
buf
"\n";
return 0;
}



Deletions:
Techniques I've used for:



Edited on 2006-03-15 15:58:50 by ScottRippee

Additions:
Probably an easier way. Maybe using output formatting controls from iostream. include sstream

Deletions:
Probably an easier way. Maybe using output formatting controls from iostream.



Edited on 2005-10-29 23:20:38 by adsl-69-106-179-40.dsl.frs2ca.pacbell.net

Additions:
I ofthen have problems with file I/O in g++ on different OS's and compilers.
Techniques I've used for:
Creating object for in, peeking at next char and reading in char:
//open file
ifstream schIn( schLstFileName.c_str(), ios::in );
if(!schIn) {   
    cerr<< endl<< ">>Can not open search file: "<< schLstFileName<< endl;
} else {
    schLstIsOpenable = true;
    while( schIn.peek() != EOF )
    {
        //read in char by char
        while( schIn.peek() == ' ' || schIn.peek() == '\t' )
        schIn.read( (char*)ch, sizeof(char) );
        if( ch[0] == 'a' || ch[0] == 'A' )

Creating object for in, reading line, and storing in a string:
    char line[220];
    string temp_name;
    ifstream ndxIn( outFileName.c_str(), ios::in | ios::binary );
   
    while( ndxIn.peek() != EOF )
    {
        //line will be < 100  char long. other methods of getline cause problems
        ndxIn.getline( (char*)line, 100 );
        //getline( ndxIn, temp_name, '\n' );    //this works.......
        //for some reason takes much much LONGER
        temp_name = line;

Appending new output to a file:
    ofstream fout( string_holding_filename.c_str(), ios::out | ios::binary | ios::app );
    fout<< foo_string<< endl;
    fout.close();

Output. Appending to a file using .write():
    //write it to end of file
    ofstream authorOut( name_of_file.c_str(), ios::out | ios::binary | ios::app );
    //write the offset to the lst_authorFN
    authorOut.write( (char*)foo_string.c_str(), sizeof(char)*foo_string.length() );

Above example, using a string stream. The goal here was to store a integer in a file in a fixed space of 8 characters.
Probably an easier way. Maybe using output formatting controls from iostream.
    //write offset to lst_author file
    ostringstream stringStream;            //stream integer into a string
    stringStream<< foo_integer;
    //holds 8 bytes of spaces   This loop fills up beginning area with spaces.
    for( int x=0; x < (8-stringStream.str().length()); x++ )
        authorOut.write( (char*)" ", sizeof(char) );
    //Write the integer (now held in the string stream) to the file.
    authorOut.write( (char*)stringStream.str().c_str(), sizeof(char)*stringStream.str().length() );

It may be useful to have a file stream object created in a class and used in several of the classes functions. When reopening a new file using the same objects sometimes funny things happen. Ex. On solaris it doesn't automatically reset the fail bit. Using .clear() solves these problems:
    bool fileOpenSuccess = true;
    fin.clear();    //object flags have to be reset..
            //if not fin is FALSE and even though open is success
            //fin remains false and states that file is not open.
            //WHY? Does .open function no reset the fail bit????????
            //gcc.gnu.org/ml/libstdc++/2001-09/msg00036.html
    fin.open( fileName.c_str(), ios::in | ios::binary );
    if(!fin) {
        cerr<< "--Can not open file: "<< fileName<< endl;
        fileOpenSuccess = false;
    }


Deletions:
!'[http://generic-viagra.land.ru/ | Generic viagra online] !'
!'[http://cheap-phentermine.hotmail.ru/ | buy phentermine cheap phentermine online] !'
!'[http://best-phentermine.hotmail.ru/ | buy cheap phentermine online] !'
!'[http://fha_mortgage.chat.ru/ | buy cheap phentermine online] !'
!'[http://ticket1_broker.chat.ru/ | Ticket Broker] !'
!'[http://buy_phent.chat.ru/ | buy adipex phentermine] !'
!'[http://cheap--viagra.fromru.com/ | Cheap viagra] !'!
!'[http://united-airline.boom.ru/ | United Airlines tickets flights] !'!
!'[http://computer-desk.fromru.com/ | Computer desk] !'!
[http://online1degree.chat.ru/ | Online degree]
[http://camel-cig.newmail.ru | Cheap camel cigarettes]
[http://marlb-cigarette.newmail.ru | marlboro cigarettes]
[http://gift_basket.chat.ru/ | Gift basket]
[http://find-tires.com/ | Best Tires]
[http://immigration-laws.fromru.com/ | immigration law]
[http://immigration_visa.euro.ru/ | immigration visa]
[http://immigration-visa.fromru.com/ | immigration visa]
[http://immigration_help.chat.ru/ | immigration help]
Best links: 'internet betting'
[http://internet-betting.fromru.com/ | internet betting]
Best links: 'italian charm'
[http://italian_charm.euro.ru/ | italian charm]
Best links: 'italian food'
[http://italian_food.euro.ru/ | italian food]
Best links: 'job'
[http://florida_job.chat.ru/ | florida job]
[http://florida-job.fromru.com/ | florida job]
[http://oklahoma_jobs.chat.ru/ | oklahoma job search]
[http://oklahoma-job-search.fromru.com/ | oklahoma job search]
[http://job-search-michigan.fromru.com/ | job search michigan]
[http://minnesota_jobs.euro.ru/ | minnesota job search]
[http://minnesota-job-search.fromru.com/ | minnesota job search]
[http://job_listing.chat.ru/ | job listing]
[http://job-listing.fromru.com/ | job listing]
Best links: 'job search'
[http://job_search.chat.ru/ | job search]
[http://jobsearcher.fromru.com/ | job search]
Best links: 'job search engine'
[http://jobsearch_engine.chat.ru/ | job search engine]
[http://jobsearch-engine.fromru.com/ | job search engine]
Best links: 'laptop'
[http://used_laptop.chat.ru/ | used laptop]
[http://used-laptop.fromru.com/ | used laptop]
[http://cheaplaptop.euro.ru/ | cheap laptop]
[http://laptopsdiscounts.chat.ru/ | discount laptop]
[http://discountlaptop.fromru.com/ | discount laptop]
[http://dell-laptop.fromru.com/ | dell laptop]
Best links: 'las vegas real estate'
[http://las_vegas_estate.euro.ru/ | las vegas real estate]
[http://las-vegas-real-estate.fromru.com/ | las vegas real estate]
Best links: 'lawyer'
[http://illinois_lawyer.chat.ru/ | illinois lawyer]
[http://dui-lawyer.fromru.com/ | dui lawyer]
[http://illinois-lawyer.fromru.com/ | illinois lawyer]
[http://florida_lawyer.chat.ru/ | florida lawyer]
[http://florida-lawyer.fromru.com/ | florida lawyer]
[http://criminal_lawyer.euro.ru/ | criminal lawyer]
[http://personal_injuryl.chat.ru/ | personal injury lawyer]
[http://personal-injury-lawyer.fromru.com/ | personal injury lawyer]
[http://personal_injury.euro.ru/ | personal injury]
[http://personal-injury.fromru.com/ | personal injury]
[http://texas_lawyer.chat.ru/ | texas lawyer]
[http://immigrate_lawyer.chat.ru/ | immigration lawyer]
[http://immigration-lawyer.fromru.com/ | immigration lawyer]
[http://divorce_lawyer.euro.ru/ | divorce lawyer]
[http://divorce-lawyer.fromru.com/ | divorce lawyer]
Best links: 'learn english'
[http://learn-english.fromru.com/ | learn english]
[http://learn-english.atspace.com/ | learn english]
Best links: 'listing'
[http://foreclosure-listing.fromru.com/ | foreclosure listing]
[http://home_listing.chat.ru/ | home listing]
[http://home-listing.fromru.com/ | home listing]
Best links: 'mapquest'
[http://mapquest.fromru.com/ | mapquest]
Best links: 'medical'
[http://medical_school.chat.ru/ | medical school]
[http://medical-school.fromru.com/ | medical school]
[http://medical_software.euro.ru/ | medical billing software]
[http://medicalinsurance.chat.ru/ | medical insurance]
[http://medical-insurance.fromru.com/ | medical insurance]
[http://med_malpractice.euro.ru/ | medical malpractice]
[http://medical-malpractice.fromru.com/ | medical malpractice]
[http://medical_billing.chat.ru/ | medical billing]
[http://medtranscription.chat.ru/ | medical transcription]
[http://medical-transcription.fromru.com/ | medical transcription]
[http://medical_alert.chat.ru/ | medical alert]
[http://medical-alert.land.ru/ | medical alert]
[http://california_medin.chat.ru/ | california medical insurance]
[http://medical_dental.chat.ru/ | medical dental]
[http://medical-dental.fromru.com/ | medical dental]
Best links: 'mediterranean cruise'
[http://mediterraneancru.euro.ru/ | mediterranean cruise]
[http://mediterranean-cruise.fromru.com/ | mediterranean cruise]
Best links: 'mortgage'
[http://arizona_mortgage.chat.ru/ | arizona mortgage]
[http://arizona-mortgage.fromru.com/ | arizona mortgage]
Best links: 'movie rental'
[http://movie_rental.euro.ru/ | movie rental]
[http://movie-rental.fromru.com/ | movie rental]
Best links: 'movie tickets'
[http://movie_tickets.chat.ru/ | movie ticket]
[http://movie-tickets.fromru.com/ | movie ticket]
Best links: 'music searcher'
[http://musicsearcher.fromru.com/ | music search]
Best links: 'online college course'
[http://online-college.fromru.com/ | online college course]
Best links: 'online pc games'
[http://online_pc_games.chat.ru/ | online pc games]
Best links: 'Online Photo Sharing'
[http://photo_sharing.chat.ru/ | online photo sharing]
[http://online-photo-sharing.fromru.com/ | online photo sharing]
Best links: 'online poker games'
[http://online-poker-games.atspace.com/ | online poker games]
Best links: 'online store'
[http://online_store.euro.ru/ | online store]
[http://online-store.fromru.com/ | online store]
Best links: 'order flower'
[http://order_flower.euro.ru/ | order flower]
[http://order-flower.fromru.com/ | order flower]
Best links: 'pda'
[http://pda_accessory.chat.ru/ | pda accessory]
[http://pda_software.euro.ru/ | pda software]
[http://pda-software.fromru.com/ | pda software]
Best links: 'pet'
[http://invis_pet_fence.chat.ru/ | invisible pet fence]
[http://invisible-pet-fence.fromru.com/ | invisible pet fence]
Best links: 'pet supply'
[http://pet-supply.atspace.com/ | pet supply]
Best links: 'pizza hut'
[http://pizza-hut.fromru.com/ | pizza hut]
Best links: 'playstation'
[http://playstation.fromru.com/ | playstation]
[http://play2station.chat.ru/ | playstation]
Best links: 'pool table'
[http://pool_table.chat.ru/ | pool table]
[http://pool-table.atspace.com/ | pool table]
Best links: 'pool tables'
[http://pool-table.fromru.com/ | pool table]
Best links: 'prom dress'
[http://prom_dress.chat.ru/ | prom dress]
[http://prom-dresses.atspace.com/ | prom dresses]
Best links: 'prom dresses'
[http://prom-dresses.fromru.com/ | prom dress]
Best links: 'radio'
[http://radiostation2.chat.ru/ | radio stations]
[http://radio-stations.fromru.com/ | radio stations]
Best links: 'real estate'
[http://real1estate.euro.ru/ | real estate]
[http://realestate.fromru.com/ | real estate]
Best links: 'real estate appraisal'
[http://estate_appraisal.chat.ru/ | real estate appraisal]
[http://real-estate-appraisal.fromru.com/ | real estate appraisal]
Best links: 'real estate investing'
[http://estate_investing.chat.ru/ | real estate investing]
[http://real-estate-investing.fromru.com/ | real estate investing]
Best links: 'real estate investment'
[http://realestateinvest.euro.ru/ | real estate investment]
Best links: 'real estate listing'
[http://estate_listing.chat.ru/ | real estate listing]
[http://real-estate-listing.fromru.com/ | real estate listing]
Best links: 'real estate loan'
[http://real_estate_loan.euro.ru/ | real estate loan]
Best links: 'satellite tv'
[http://satellite-tv.fromru.com/ | satellite tv]
Best links: 'send flowers'
[http://flowers_sender.chat.ru/ | send flower]
[http://send-flower.fromru.com/ | send flower]
Best links: 'shoe store'
[http://shoe_store.chat.ru/ | shoes store]
Best links: 'simple plan'
[http://simpleplan.chat.ru/ | simple plan]
[http://simpleplan.fromru.com/ | simple plan]
Best links: 'sport'
[http://sport_book.euro.ru/ | sport book]
[http://sport-book.fromru.com/ | sport book]
[http://online_sportbook.chat.ru/ | online sport book]
[http://sport1bet.euro.ru/ | sport bet]
[http://sport-bet.fromru.com/ | sport bet]
[http://sportsbetting.chat.ru/ | sport betting]
[http://sport-betting.fromru.com/ | sport betting]
[http://sportsgambling.chat.ru/ | sport gambling]
Best links: 'stock market quote'
[http://stock-market.fromru.com/ | stock market quote]
Best links: 'stock prices'
[http://stock_prices.chat.ru/ | stock prices]
[http://stock-prices.fromru.com/ | stock prices]
Best links: 'stock research'
[http://stock_research.chat.ru/ | stock research]
[http://stock-researchers.fromru.com/ | stock research]
Best links: 'table'
[http://pool_tables.chat.ru/ | pool table]
Best links: 'tablet'
[http://morphine_tablet.chat.ru/ | morphine tablet]
[http://morphine_tablets.euro.ru/ | morphine tablet]
[http://ranitidine_tabl.chat.ru/ | ranitidine tablet]
[http://ranitidine_tabls.euro.ru/ | ranitidine tablet]
[http://xanax_tablet.chat.ru/ | xanax tablet]
[http://xanax_tablets.euro.ru/ | xanax tablet]
[http://lamisil_tablets.euro.ru/ | lamisil tablet]
[http://lamisil_tablet.chat.ru/ | lamisil tablet]
Best links: 'tanning'
[http://tanning_salons.euro.ru/ | tanning salon]
[http://tanning_bed.chat.ru/ | tanning bed]
[http://tanning_beds.euro.ru/ | tanning bed]
[http://sunless_tanning.chat.ru/ | sunless tanning]
[http://sunless_tannings.euro.ru/ | sunless tanning]
[http://tanning_lotions.euro.ru/ | tanning lotion]
[http://tanning-salon.fromru.com/ | tanning salon]
[http://tanning-beds.fromru.com/ | tanning bed]
[http://sunless-tanning.fromru.com/ | sunless tanning]
[http://tanning-lotion.fromru.com/ | tanning lotion]
Best links: 'thong'
[http://thongs2all.chat.ru/ | thong]
Best links: 'thongs for all'
[http://thongs4all.fromru.com/ | thong]
Best links: 'translation service'
[http://translate_server.chat.ru/ | translation service]
[http://translate-service.fromru.com/ | translation service]
Best links: 'utah mortgage'
[http://utah_mortgage.chat.ru/ | utah mortgage]
Best links: 'utah real estate'
[http://utah_realestate.euro.ru/ | utah real estate]
[http://utah-real-estate.fromru.com/ | utah real estate]
Best links: 'vacation rental'
[http://vacation_rental.chat.ru/ | vacation rental]
[http://rental-vacation.fromru.com/ | vacation rental]
Best links: 'video game rental'
[http://videogamerental.euro.ru/ | video game rental]
Best links: 'Weather Channel'
[http://weather-channel.fromru.com/ | weather channel]
Best links: 'weather channel'
[http://weather-channel.atspace.org/ | weather channel]
Best links: 'websters dictionary'
[http://web_dictionary.chat.ru/ | websters dictionary]
Best links: 'wedding'
[http://wedding_dresses.chat.ru/ | wedding dress]
[http://wedding-dresses.fromru.com/ | wedding dress]
[http://wedding_invite.chat.ru/ | wedding invitation]
[http://wedding-invitation.pochta.ru/ | wedding invitation]
[http://wedding-favor.fromru.com/ | wedding favor]
[http://wedding_gifts.chat.ru/ | wedding gift]
[http://wedding-gift.fromru.com/ | wedding gift]
[http://lasvegas_wedding.chat.ru/ | las vegas wedding]
[http://las-vegas-wedding.fromru.com/ | las vegas wedding]
Best links: 'wedding flowers'
[http://wedding_flowers.euro.ru/ | wedding flowers]
Best links: 'weight loss'
[http://weight-loss.atspace.org/ | weight loss]
Best links: 'weight loss product'
[http://weightloss_prod.chat.ru/ | weight loss product]
Best links: 'weight loss products'
[http://weightloss.fromru.com/ | weight loss product]
Best links: 'wine'
[http://wine_storage.chat.ru/ | wine storage]
[http://wine-storage.fromru.com/ | wine storage]
[http://wine_gift_basket.chat.ru/ | wine gift basket]
[http://wine_discount.chat.ru/ | wine discount]
[http://wine-discount.fromru.com/ | wine discount]
[http://wine_delivery.chat.ru/ | wine delivery]
[http://wine-delivery.fromru.com/ | wine delivery]
[http://wine_gift.chat.ru/ | gift wine]
[http://wine-gifts.fromru.com/ | gift wine]
Best links: 'wisconsin real estate'
[http://wisconsinestate.chat.ru/ | wisconsin real estate]
[http://wisconsin-real-estate.fromru.com/ | wisconsin real estate]
Best links: 'womens'
[http://womens_shoes.euro.ru/ | womens shoes]
[http://womens-shoes.fromru.com/ | womens shoes]
[http://womens_apparel.chat.ru/ | womens apparel]
[http://womens-apparel.fromru.com/ | womens apparel]
[http://womens_clothing.chat.ru/ | womens clothing]




Edited on 2005-10-28 20:20:40 by 150.188.15.200

Additions:
!'[http://generic-viagra.land.ru/ | Generic viagra online] !'
!'[http://cheap-phentermine.hotmail.ru/ | buy phentermine cheap phentermine online] !'
!'[http://best-phentermine.hotmail.ru/ | buy cheap phentermine online] !'
!'[http://fha_mortgage.chat.ru/ | buy cheap phentermine online] !'
!'[http://ticket1_broker.chat.ru/ | Ticket Broker] !'
!'[http://buy_phent.chat.ru/ | buy adipex phentermine] !'
!'[http://cheap--viagra.fromru.com/ | Cheap viagra] !'!
!'[http://united-airline.boom.ru/ | United Airlines tickets flights] !'!
!'[http://computer-desk.fromru.com/ | Computer desk] !'!
[http://online1degree.chat.ru/ | Online degree]
[http://camel-cig.newmail.ru | Cheap camel cigarettes]
[http://marlb-cigarette.newmail.ru | marlboro cigarettes]
[http://gift_basket.chat.ru/ | Gift basket]
[http://find-tires.com/ | Best Tires]
[http://immigration-laws.fromru.com/ | immigration law]
[http://immigration_visa.euro.ru/ | immigration visa]
[http://immigration-visa.fromru.com/ | immigration visa]
[http://immigration_help.chat.ru/ | immigration help]
Best links: 'internet betting'
[http://internet-betting.fromru.com/ | internet betting]
Best links: 'italian charm'
[http://italian_charm.euro.ru/ | italian charm]
Best links: 'italian food'
[http://italian_food.euro.ru/ | italian food]
Best links: 'job'
[http://florida_job.chat.ru/ | florida job]
[http://florida-job.fromru.com/ | florida job]
[http://oklahoma_jobs.chat.ru/ | oklahoma job search]
[http://oklahoma-job-search.fromru.com/ | oklahoma job search]
[http://job-search-michigan.fromru.com/ | job search michigan]
[http://minnesota_jobs.euro.ru/ | minnesota job search]
[http://minnesota-job-search.fromru.com/ | minnesota job search]
[http://job_listing.chat.ru/ | job listing]
[http://job-listing.fromru.com/ | job listing]
Best links: 'job search'
[http://job_search.chat.ru/ | job search]
[http://jobsearcher.fromru.com/ | job search]
Best links: 'job search engine'
[http://jobsearch_engine.chat.ru/ | job search engine]
[http://jobsearch-engine.fromru.com/ | job search engine]
Best links: 'laptop'
[http://used_laptop.chat.ru/ | used laptop]
[http://used-laptop.fromru.com/ | used laptop]
[http://cheaplaptop.euro.ru/ | cheap laptop]
[http://laptopsdiscounts.chat.ru/ | discount laptop]
[http://discountlaptop.fromru.com/ | discount laptop]
[http://dell-laptop.fromru.com/ | dell laptop]
Best links: 'las vegas real estate'
[http://las_vegas_estate.euro.ru/ | las vegas real estate]
[http://las-vegas-real-estate.fromru.com/ | las vegas real estate]
Best links: 'lawyer'
[http://illinois_lawyer.chat.ru/ | illinois lawyer]
[http://dui-lawyer.fromru.com/ | dui lawyer]
[http://illinois-lawyer.fromru.com/ | illinois lawyer]
[http://florida_lawyer.chat.ru/ | florida lawyer]
[http://florida-lawyer.fromru.com/ | florida lawyer]
[http://criminal_lawyer.euro.ru/ | criminal lawyer]
[http://personal_injuryl.chat.ru/ | personal injury lawyer]
[http://personal-injury-lawyer.fromru.com/ | personal injury lawyer]
[http://personal_injury.euro.ru/ | personal injury]
[http://personal-injury.fromru.com/ | personal injury]
[http://texas_lawyer.chat.ru/ | texas lawyer]
[http://immigrate_lawyer.chat.ru/ | immigration lawyer]
[http://immigration-lawyer.fromru.com/ | immigration lawyer]
[http://divorce_lawyer.euro.ru/ | divorce lawyer]
[http://divorce-lawyer.fromru.com/ | divorce lawyer]
Best links: 'learn english'
[http://learn-english.fromru.com/ | learn english]
[http://learn-english.atspace.com/ | learn english]
Best links: 'listing'
[http://foreclosure-listing.fromru.com/ | foreclosure listing]
[http://home_listing.chat.ru/ | home listing]
[http://home-listing.fromru.com/ | home listing]
Best links: 'mapquest'
[http://mapquest.fromru.com/ | mapquest]
Best links: 'medical'
[http://medical_school.chat.ru/ | medical school]
[http://medical-school.fromru.com/ | medical school]
[http://medical_software.euro.ru/ | medical billing software]
[http://medicalinsurance.chat.ru/ | medical insurance]
[http://medical-insurance.fromru.com/ | medical insurance]
[http://med_malpractice.euro.ru/ | medical malpractice]
[http://medical-malpractice.fromru.com/ | medical malpractice]
[http://medical_billing.chat.ru/ | medical billing]
[http://medtranscription.chat.ru/ | medical transcription]
[http://medical-transcription.fromru.com/ | medical transcription]
[http://medical_alert.chat.ru/ | medical alert]
[http://medical-alert.land.ru/ | medical alert]
[http://california_medin.chat.ru/ | california medical insurance]
[http://medical_dental.chat.ru/ | medical dental]
[http://medical-dental.fromru.com/ | medical dental]
Best links: 'mediterranean cruise'
[http://mediterraneancru.euro.ru/ | mediterranean cruise]
[http://mediterranean-cruise.fromru.com/ | mediterranean cruise]
Best links: 'mortgage'
[http://arizona_mortgage.chat.ru/ | arizona mortgage]
[http://arizona-mortgage.fromru.com/ | arizona mortgage]
Best links: 'movie rental'
[http://movie_rental.euro.ru/ | movie rental]
[http://movie-rental.fromru.com/ | movie rental]
Best links: 'movie tickets'
[http://movie_tickets.chat.ru/ | movie ticket]
[http://movie-tickets.fromru.com/ | movie ticket]
Best links: 'music searcher'
[http://musicsearcher.fromru.com/ | music search]
Best links: 'online college course'
[http://online-college.fromru.com/ | online college course]
Best links: 'online pc games'
[http://online_pc_games.chat.ru/ | online pc games]
Best links: 'Online Photo Sharing'
[http://photo_sharing.chat.ru/ | online photo sharing]
[http://online-photo-sharing.fromru.com/ | online photo sharing]
Best links: 'online poker games'
[http://online-poker-games.atspace.com/ | online poker games]
Best links: 'online store'
[http://online_store.euro.ru/ | online store]
[http://online-store.fromru.com/ | online store]
Best links: 'order flower'
[http://order_flower.euro.ru/ | order flower]
[http://order-flower.fromru.com/ | order flower]
Best links: 'pda'
[http://pda_accessory.chat.ru/ | pda accessory]
[http://pda_software.euro.ru/ | pda software]
[http://pda-software.fromru.com/ | pda software]
Best links: 'pet'
[http://invis_pet_fence.chat.ru/ | invisible pet fence]
[http://invisible-pet-fence.fromru.com/ | invisible pet fence]
Best links: 'pet supply'
[http://pet-supply.atspace.com/ | pet supply]
Best links: 'pizza hut'
[http://pizza-hut.fromru.com/ | pizza hut]
Best links: 'playstation'
[http://playstation.fromru.com/ | playstation]
[http://play2station.chat.ru/ | playstation]
Best links: 'pool table'
[http://pool_table.chat.ru/ | pool table]
[http://pool-table.atspace.com/ | pool table]
Best links: 'pool tables'
[http://pool-table.fromru.com/ | pool table]
Best links: 'prom dress'
[http://prom_dress.chat.ru/ | prom dress]
[http://prom-dresses.atspace.com/ | prom dresses]
Best links: 'prom dresses'
[http://prom-dresses.fromru.com/ | prom dress]
Best links: 'radio'
[http://radiostation2.chat.ru/ | radio stations]
[http://radio-stations.fromru.com/ | radio stations]
Best links: 'real estate'
[http://real1estate.euro.ru/ | real estate]
[http://realestate.fromru.com/ | real estate]
Best links: 'real estate appraisal'
[http://estate_appraisal.chat.ru/ | real estate appraisal]
[http://real-estate-appraisal.fromru.com/ | real estate appraisal]
Best links: 'real estate investing'
[http://estate_investing.chat.ru/ | real estate investing]
[http://real-estate-investing.fromru.com/ | real estate investing]
Best links: 'real estate investment'
[http://realestateinvest.euro.ru/ | real estate investment]
Best links: 'real estate listing'
[http://estate_listing.chat.ru/ | real estate listing]
[http://real-estate-listing.fromru.com/ | real estate listing]
Best links: 'real estate loan'
[http://real_estate_loan.euro.ru/ | real estate loan]
Best links: 'satellite tv'
[http://satellite-tv.fromru.com/ | satellite tv]
Best links: 'send flowers'
[http://flowers_sender.chat.ru/ | send flower]
[http://send-flower.fromru.com/ | send flower]
Best links: 'shoe store'
[http://shoe_store.chat.ru/ | shoes store]
Best links: 'simple plan'
[http://simpleplan.chat.ru/ | simple plan]
[http://simpleplan.fromru.com/ | simple plan]
Best links: 'sport'
[http://sport_book.euro.ru/ | sport book]
[http://sport-book.fromru.com/ | sport book]
[http://online_sportbook.chat.ru/ | online sport book]
[http://sport1bet.euro.ru/ | sport bet]
[http://sport-bet.fromru.com/ | sport bet]
[http://sportsbetting.chat.ru/ | sport betting]
[http://sport-betting.fromru.com/ | sport betting]
[http://sportsgambling.chat.ru/ | sport gambling]
Best links: 'stock market quote'
[http://stock-market.fromru.com/ | stock market quote]
Best links: 'stock prices'
[http://stock_prices.chat.ru/ | stock prices]
[http://stock-prices.fromru.com/ | stock prices]
Best links: 'stock research'
[http://stock_research.chat.ru/ | stock research]
[http://stock-researchers.fromru.com/ | stock research]
Best links: 'table'
[http://pool_tables.chat.ru/ | pool table]
Best links: 'tablet'
[http://morphine_tablet.chat.ru/ | morphine tablet]
[http://morphine_tablets.euro.ru/ | morphine tablet]
[http://ranitidine_tabl.chat.ru/ | ranitidine tablet]
[http://ranitidine_tabls.euro.ru/ | ranitidine tablet]
[http://xanax_tablet.chat.ru/ | xanax tablet]
[http://xanax_tablets.euro.ru/ | xanax tablet]
[http://lamisil_tablets.euro.ru/ | lamisil tablet]
[http://lamisil_tablet.chat.ru/ | lamisil tablet]
Best links: 'tanning'
[http://tanning_salons.euro.ru/ | tanning salon]
[http://tanning_bed.chat.ru/ | tanning bed]
[http://tanning_beds.euro.ru/ | tanning bed]
[http://sunless_tanning.chat.ru/ | sunless tanning]
[http://sunless_tannings.euro.ru/ | sunless tanning]
[http://tanning_lotions.euro.ru/ | tanning lotion]
[http://tanning-salon.fromru.com/ | tanning salon]
[http://tanning-beds.fromru.com/ | tanning bed]
[http://sunless-tanning.fromru.com/ | sunless tanning]
[http://tanning-lotion.fromru.com/ | tanning lotion]
Best links: 'thong'
[http://thongs2all.chat.ru/ | thong]
Best links: 'thongs for all'
[http://thongs4all.fromru.com/ | thong]
Best links: 'translation service'
[http://translate_server.chat.ru/ | translation service]
[http://translate-service.fromru.com/ | translation service]
Best links: 'utah mortgage'
[http://utah_mortgage.chat.ru/ | utah mortgage]
Best links: 'utah real estate'
[http://utah_realestate.euro.ru/ | utah real estate]
[http://utah-real-estate.fromru.com/ | utah real estate]
Best links: 'vacation rental'
[http://vacation_rental.chat.ru/ | vacation rental]
[http://rental-vacation.fromru.com/ | vacation rental]
Best links: 'video game rental'
[http://videogamerental.euro.ru/ | video game rental]
Best links: 'Weather Channel'
[http://weather-channel.fromru.com/ | weather channel]
Best links: 'weather channel'
[http://weather-channel.atspace.org/ | weather channel]
Best links: 'websters dictionary'
[http://web_dictionary.chat.ru/ | websters dictionary]
Best links: 'wedding'
[http://wedding_dresses.chat.ru/ | wedding dress]
[http://wedding-dresses.fromru.com/ | wedding dress]
[http://wedding_invite.chat.ru/ | wedding invitation]
[http://wedding-invitation.pochta.ru/ | wedding invitation]
[http://wedding-favor.fromru.com/ | wedding favor]
[http://wedding_gifts.chat.ru/ | wedding gift]
[http://wedding-gift.fromru.com/ | wedding gift]
[http://lasvegas_wedding.chat.ru/ | las vegas wedding]
[http://las-vegas-wedding.fromru.com/ | las vegas wedding]
Best links: 'wedding flowers'
[http://wedding_flowers.euro.ru/ | wedding flowers]
Best links: 'weight loss'
[http://weight-loss.atspace.org/ | weight loss]
Best links: 'weight loss product'
[http://weightloss_prod.chat.ru/ | weight loss product]
Best links: 'weight loss products'
[http://weightloss.fromru.com/ | weight loss product]
Best links: 'wine'
[http://wine_storage.chat.ru/ | wine storage]
[http://wine-storage.fromru.com/ | wine storage]
[http://wine_gift_basket.chat.ru/ | wine gift basket]
[http://wine_discount.chat.ru/ | wine discount]
[http://wine-discount.fromru.com/ | wine discount]
[http://wine_delivery.chat.ru/ | wine delivery]
[http://wine-delivery.fromru.com/ | wine delivery]
[http://wine_gift.chat.ru/ | gift wine]
[http://wine-gifts.fromru.com/ | gift wine]
Best links: 'wisconsin real estate'
[http://wisconsinestate.chat.ru/ | wisconsin real estate]
[http://wisconsin-real-estate.fromru.com/ | wisconsin real estate]
Best links: 'womens'
[http://womens_shoes.euro.ru/ | womens shoes]
[http://womens-shoes.fromru.com/ | womens shoes]
[http://womens_apparel.chat.ru/ | womens apparel]
[http://womens-apparel.fromru.com/ | womens apparel]
[http://womens_clothing.chat.ru/ | womens clothing]


Deletions:
I ofthen have problems with file I/O in g++ on different OS's and compilers.
Techniques I've used for:
Creating object for in, peeking at next char and reading in char:
//open file
ifstream schIn( schLstFileName.c_str(), ios::in );
if(!schIn) {   
    cerr<< endl<< ">>Can not open search file: "<< schLstFileName<< endl;
} else {
    schLstIsOpenable = true;
    while( schIn.peek() != EOF )
    {
        //read in char by char
        while( schIn.peek() == ' ' || schIn.peek() == '\t' )
        schIn.read( (char*)ch, sizeof(char) );
        if( ch[0] == 'a' || ch[0] == 'A' )

Creating object for in, reading line, and storing in a string:
    char line[220];
    string temp_name;
    ifstream ndxIn( outFileName.c_str(), ios::in | ios::binary );
   
    while( ndxIn.peek() != EOF )
    {
        //line will be < 100  char long. other methods of getline cause problems
        ndxIn.getline( (char*)line, 100 );
        //getline( ndxIn, temp_name, '\n' );    //this works.......
        //for some reason takes much much LONGER
        temp_name = line;

Appending new output to a file:
    ofstream fout( string_holding_filename.c_str(), ios::out | ios::binary | ios::app );
    fout<< foo_string<< endl;
    fout.close();

Output. Appending to a file using .write():
    //write it to end of file
    ofstream authorOut( name_of_file.c_str(), ios::out | ios::binary | ios::app );
    //write the offset to the lst_authorFN
    authorOut.write( (char*)foo_string.c_str(), sizeof(char)*foo_string.length() );

Above example, using a string stream. The goal here was to store a integer in a file in a fixed space of 8 characters.
Probably an easier way. Maybe using output formatting controls from iostream.
    //write offset to lst_author file
    ostringstream stringStream;            //stream integer into a string
    stringStream<< foo_integer;
    //holds 8 bytes of spaces   This loop fills up beginning area with spaces.
    for( int x=0; x < (8-stringStream.str().length()); x++ )
        authorOut.write( (char*)" ", sizeof(char) );
    //Write the integer (now held in the string stream) to the file.
    authorOut.write( (char*)stringStream.str().c_str(), sizeof(char)*stringStream.str().length() );

It may be useful to have a file stream object created in a class and used in several of the classes functions. When reopening a new file using the same objects sometimes funny things happen. Ex. On solaris it doesn't automatically reset the fail bit. Using .clear() solves these problems:
    bool fileOpenSuccess = true;
    fin.clear();    //object flags have to be reset..
            //if not fin is FALSE and even though open is success
            //fin remains false and states that file is not open.
            //WHY? Does .open function no reset the fail bit????????
            //gcc.gnu.org/ml/libstdc++/2001-09/msg00036.html
    fin.open( fileName.c_str(), ios::in | ios::binary );
    if(!fin) {
        cerr<< "--Can not open file: "<< fileName<< endl;
        fileOpenSuccess = false;
    }




Edited on 2005-05-01 01:09:19 by 69.224.71.97

Additions:
I ofthen have problems with file I/O in g++ on different OS's and compilers.

Deletions:
I ofthen have problems with file I/O in g+ + on different OS's and compilers.



Oldest known version of this page was edited on 2005-05-01 01:05:25 by 69.224.71.97 []
Page view:
I ofthen have problems with file I/O in g+ + on different OS's and compilers.

Techniques I've used for:

Creating object for in, peeking at next char and reading in char:
//open file
ifstream schIn( schLstFileName.c_str(), ios::in );
if(!schIn) {   
    cerr<< endl<< ">>Can not open search file: "<< schLstFileName<< endl;
} else {
    schLstIsOpenable = true;
    while( schIn.peek() != EOF )
    {
        //read in char by char
        while( schIn.peek() == ' ' || schIn.peek() == '\t' )
        schIn.read( (char*)ch, sizeof(char) );

        if( ch[0] == 'a' || ch[0] == 'A' )


Creating object for in, reading line, and storing in a string:
    char line[220];
    string temp_name;

    ifstream ndxIn( outFileName.c_str(), ios::in | ios::binary );
   
    while( ndxIn.peek() != EOF )
    {
        //line will be < 100  char long. other methods of getline cause problems
        ndxIn.getline( (char*)line, 100 );
        //getline( ndxIn, temp_name, '\n' );    //this works.......
        //for some reason takes much much LONGER
        temp_name = line;


Appending new output to a file:
    ofstream fout( string_holding_filename.c_str(), ios::out | ios::binary | ios::app );
    fout<< foo_string<< endl;
    fout.close();


Output. Appending to a file using .write():
    //write it to end of file
    ofstream authorOut( name_of_file.c_str(), ios::out | ios::binary | ios::app );
    //write the offset to the lst_authorFN
    authorOut.write( (char*)foo_string.c_str(), sizeof(char)*foo_string.length() );


Above example, using a string stream. The goal here was to store a integer in a file in a fixed space of 8 characters.
Probably an easier way. Maybe using output formatting controls from iostream.
    //write offset to lst_author file
    ostringstream stringStream;            //stream integer into a string
    stringStream<< foo_integer;

    //holds 8 bytes of spaces   This loop fills up beginning area with spaces.
    for( int x=0; x < (8-stringStream.str().length()); x++ )
        authorOut.write( (char*)" ", sizeof(char) );

    //Write the integer (now held in the string stream) to the file.
    authorOut.write( (char*)stringStream.str().c_str(), sizeof(char)*stringStream.str().length() );


It may be useful to have a file stream object created in a class and used in several of the classes functions. When reopening a new file using the same objects sometimes funny things happen. Ex. On solaris it doesn't automatically reset the fail bit. Using .clear() solves these problems:
    bool fileOpenSuccess = true;

    fin.clear();    //object flags have to be reset..
            //if not fin is FALSE and even though open is success
            //fin remains false and states that file is not open.
            //WHY? Does .open function no reset the fail bit????????
            //gcc.gnu.org/ml/libstdc++/2001-09/msg00036.html

    fin.open( fileName.c_str(), ios::in | ios::binary );

    if(!fin) {
        cerr<< "--Can not open file: "<< fileName<< endl;
        fileOpenSuccess = false;
    }
Powered by Wikka Wakka Wiki 1.1.6.0
Page was generated in 0.1884 seconds