cout output prob large file read

This is a discussion on cout output prob large file read within the C++ Programming forums, part of the General Programming Boards category; lkxm jnlkxn jnlkxo jnlkxp jnlkx q <== here jnlkxr jnlkxs jnlkxt jnlkxu j <== here nlkxv jnlkxw jnlkxx jnlkxy jnlk ...

  1. #1
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

    cout output prob large file read

    lkxm
    jnlkxn
    jnlkxo
    jnlkxp
    jnlkx
    q <== here
    jnlkxr
    jnlkxs
    jnlkxt
    jnlkxu
    j <== here
    nlkxv
    jnlkxw
    jnlkxx
    jnlkxy
    jnlk <== here
    xz <== here
    jnlkxa
    jnlkxb
    jnlkxc
    jnlkxd

    jnlkxe
    jnlkyf
    jnlkyg
    jnlkyh
    jnl <== here
    kyi <== here
    jnlkyj
    jnlkyk
    jnlkyl
    jnlkym

    jnlkyn
    jnlkyo
    jnlkyp
    jnlkyq
    jn <== here
    lkyr <== here
    jnlkys
    jnlkyt
    jnlkyu
    jnlky
    v <== here
    jnlkyw
    jnlkyx
    jnlkyy
    jnlkyz
    j <== here
    nlkya
    jnlkyb
    jnlkyc
    jnlkyd
    jnlk <== here
    ye <== here
    jnlkzf
    jnlkzg
    jnlkzh
    jnlkzi

    jnlkzj
    jnlkzk
    jnlkzl
    jnlkzm
    jnl <== here
    kzn <== here
    jnlkzo
    jnlkzp
    jnlkzq
    jnlkzr

    jnlkzs
    jnlkzt
    jnlkzu
    jnlkzv
    jn <== here
    lkzw
    jnlkzx
    jnlkzy
    jnlkzz
    jnlkz
    a <== here
    jnlkzb
    jnlkzc
    jnlkzd
    jnlkze
    j <== here
    nlkaf
    jnlkag
    jnlkah
    jnlkai
    jnlk
    aj <== here
    jnlkak
    jnlkal
    jnlkam
    jnlkan

    jnlkao
    jnlkap
    jnlkaq
    jnlkar
    jnl <== here
    kas <== here
    jnlkat <==meow
    jnlkau
    jnlkav
    jnlkaw

    jnlkax
    jnlkay
    jnlkaz
    jnlkaa
    jn <== here
    lkab <== here
    jnlkac
    jnlkad
    jnlkae
    jnlkb
    f <== here
    jnlkbg
    jnlkbh
    jnlkbi
    jnlkbj
    j <== here
    nlkbk
    jnlkbl
    jnlkbm
    jnlkbn
    jnlk <== here
    bo <== here
    jnlkbp
    jnlkbq
    jnlkbr
    jnlkbs

    jnlkbt
    jnlkbu
    jnlkbv
    jnlkbw
    jnl <== here
    kbx <== here
    jnlkby
    jnlkbz
    jnlkba
    jnlkbb

    jnlkbc
    jnlkbd
    jnlkbe
    jnlkcf
    jn <== here
    lkcg
    jnlkch
    jnlkci
    jnlkcj
    jnlkc
    k <== here
    jnlkcl
    jnlkcm
    jnlkcn
    jnlkco
    j <== here
    nlkcp
    jnlkcq
    jnlkcr
    jnlkcs
    jnlk
    ct <== here
    jnlkcu
    jnlkcv
    jnlkcw
    jnlkcx

    jnlkcy
    jnlkcz
    jnlkca
    jnlkcb
    jnl <== here
    kcc <== here
    jnlkcd
    jnlkce
    jnlkdf
    jnlkdg

    jnlkdh
    jnlkdi
    jnlkdj
    jnlkdk
    jn <== here
    lkdl <== here
    jnlkdm
    jnlkdn
    jnlkdo
    jnlkd
    p <== here
    jnlkdq
    jnlkdr
    jnlkds
    jnlkdt
    j <== here
    nlkdu
    jnlkdv
    jnlkdw
    jnlkdx
    jnlk <== here
    dy <== here
    jnlkdz
    jnlkda
    jnlkdb
    jnlkdc

    jnlkdd
    jnlkde
    jnlkef
    jnlkeg
    jnl <== here
    keh <== here
    jnlkei
    jnlkej
    jnlkek
    jnlkel

    jnlkem
    jnlken
    jnlkeo
    jnlkep
    jn <== here
    lkeq <== here
    jnlker
    jnlkes
    jnlket
    jnlke
    u <== here
    jnlkev
    jnlkew
    jnlkex
    jnlkey
    j <== here
    nlkez
    jnlkea
    jnlkeb
    jnlkec
    jnlk <== here
    ed <== here
    jnlkee
    jnlkff
    jnlkfg
    jnlkfh

    jnlkfi
    jnlkfj
    jnlkfk
    jnlkfl
    jnl <== here
    kfm <== here
    jnlkfn
    jnlkfo
    jnlkfp
    jnlkfq

    jnlkfr
    jnlkfs
    jnlkft
    jnlkfu
    jnlkfv^C
    C:\Dev-Cpp\project333 misc>
    i do not understand why some of these are coming out split ? it should read in 30 char to b then print them. does ' \n' have anything to do with the reason that they are split ? the text displayed should sit there till enter is hit then print 30 chars more at 6 per line aka key roll .

    here is the code for the large file text reader
    Code:
    /* Project333largetextreader0002.cpp */
    
        // Project333largetextreader0002.cpp
        
    #include <fstream>
    #include <iostream>
    
    using namespace std ;
    
    
    int main() {
        char b;
        
            ifstream in("testlargetextread.txt");
            
            while(in) {
                      for(int d = 0 ; d < 31 ; d++) {
                              in.get(b) ;
                              cout << b  ;
                              } // end for
                              cin.get() ;
                              } // end while in
                              
    
    } // end main()
    i believe there is '\n' contained in the txt file but at the end of each 6 chars should not be a prob. you may recognize text as part of rogster001 text file contest. is output of function. one of many functions tried.

    doing just 6 char give a file over 2gigs.
    Last edited by kryptkat; 02-06-2010 at 09:01 AM.

  2. #2
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    Well if there are '\n's embedded of course they will split. A simple
    Code:
    if( b == '\n')
    {
         continue;
    }
    before writing the character to the screen should suffice...

    Warning: this is pre-caffeination advice. YMMV.
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  3. #3
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    thank you i will give that a try.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 04:53 AM
  2. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 04:39 AM
  3. Base converter libary
    By cdonlan in forum C++ Programming
    Replies: 22
    Last Post: 05-15-2005, 02:11 AM
  4. Need help fixing bugs in data parsing program
    By daluu in forum C Programming
    Replies: 8
    Last Post: 03-27-2003, 06:02 PM
  5. Simple File Creation Algorithm
    By muffin in forum C Programming
    Replies: 13
    Last Post: 08-24-2001, 04:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21