getline() special...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FightingWolf
    New Member
    • Feb 2007
    • 2

    getline() special...

    Hey,

    first of all sorry for my bad english, but I'm from Germany ;)

    I found something special in the getline() function, I don't understand.

    If I use the getline function in case of an Excel-sheet or an image - to get the image-data - the getline function breakes after a NULL termination ( \0 )

    fstream oFile_e;

    oFile_e.open("B AB.xls",ios::in );

    oFile_e.getline (chTest, 100,'\n');


    BAB.xls containes the \0 from position 9 to 12

    chTest is after the getline function only filled up to position 9 ( after the first \0 )

    --> no problem with the ios::binary mode. With this mode it's possible to read the whole data.

    But if I write out some chars in a file and some of them are \0, I can read the whole data WITHOUT the ios::binary mode.

    Do you understand that phenomenon?
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Hi. What is the \0 character you are referring to in the excel file? Is it a blank cell, NULL or zero?

    Comment

    • FightingWolf
      New Member
      • Feb 2007
      • 2

      #3
      \0 = NULL

      in hex = 0x00

      Comment

      Working...