473,396 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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("BAB.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?
Feb 26 '07 #1
2 1417
willakawill
1,646 1GB
Hi. What is the \0 character you are referring to in the excel file? Is it a blank cell, NULL or zero?
Feb 26 '07 #2
\0 = NULL

in hex = 0x00
Feb 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jim Phelps | last post by:
Hello all, I am in a bit of a pickle using the getline function with an ifstream. It does not seem to work as advertised. Here is my scenario. In a nutshell, my code needs to pick up a fixed...
1
by: ma740988 | last post by:
Consider: ifstrem MyFile("extractMe.txt"); string Str; getline(MyFile, Str); getline above extracts the contents of MyFile and place into the string object. Deduced using FROM/TO logic I...
10
by: Skywise | last post by:
I keep getting the following error upon compiling: c:\c++ files\programs\stellardebug\unitcode.h(677) : error C2664: 'class istream &__thiscall istream::getline(char *,int,char)' : cannot convert...
4
by: sam | last post by:
Hi, How can I use getline ignore the commandline arguments? Thanks Sam
18
by: Amadeus W. M. | last post by:
I'm trying to read a whole file as a single string, using the getline() function, as in the example below. I can't tell what I'm doing wrong. Tried g++ 3.2, 3.4 and 4.0. Thanks! #include...
5
by: allspamgoeshere3 | last post by:
Hi! I'm having trouble reading text lines from a file describing the levels for a simple game I'm creating. Inside the function that reads the content of the file there is a loop that basically...
1
by: hauser | last post by:
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...
4
by: IanWright | last post by:
I'm having trouble with getline function, in the sense that I keep getting an error, and I'm wondering if anyone can help? The code I'm using is below. What it does is to read a line from one...
10
by: Terry IT | last post by:
hi, i'm using code like this string s while(getline(cin,s)){ process(s); } // this is the last line process(s);
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.