Solved

Text file gets word wrapped somehow on it's own

Posted on 2003-11-13
7
224 Views
Last Modified: 2010-04-01
I have a user of one of my programs who is experiencing difficulties.  The  program saves data to a text file and is read by the program by a series of getline(...).  This particular user when she sends me this text file for examination always sends me a word-wrapped file (which the program won't tolerate).  No one else is experiencing this problem.  She claims not to alter the contents of the file and claims that the problem occurs after she restarts her computer after she already saved some data.  Is it possible for a text file to get word wrapped in some way through a Windows setting or another program installed on to the computer?
0
Comment
Question by:georgiek50
7 Comments
 

Expert Comment

by:fester4
ID: 9741729
Is she opening the text file? If she opens it with word it may do that, if she opens it with something like notepad it shouldn't.

I am not really sure but thought that may do something
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 9741790
It depends on Notepad; there is an option (on W2K) to wrap or not.  It may be possible that this user is the only one that has the wordwrap setting turned on in Notepad.
0
 
LVL 1

Author Comment

by:georgiek50
ID: 9743486
The user claims she hasn't touched the file both times that this has happened.  I opened it in Notepad (i keep the word wrap setting OFF) and it was already prewrapped.  To explain this a little further, some of the data always spans more than what's visible on the screen but my program DOES NOT output the '\n' until it has copied that data.
The saving function is something like this:

while (pSave != NULL)
{
     File << pSave->szData << endl;

     pSave = pSave->pNext;
}

where szData is a real long string (up to 5000 chars)

Out of thousands of users, she is the only one with this problem (afaik)

When I open it in Notepad what should be one really long line is about 15 lines (when I toggle word-wrap this does not change whiche means it's already pre-wrapped).

Thoughts?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 49

Accepted Solution

by:
DanRollins earned 250 total points
ID: 9762636
Some email applications could do that.   You did not say specifically, so I should ask:  Is she sending the file as an attachment? She certainly must to avoid problems.

If there is still a mystery, then get her on the phone and walk her through the steps of opening the file in Notepad.  Have her visually verify that it is not wrapped.  Then close without saving, and send as an attachment.

Finally, look at the file with a binary editor (not a text editor)  Maybe the line-ends are \n rather than \r\n.  If you (and nothing else works) you might be able to write a simple program to delete then unwanted line ends.

In answer to your question:
No.  I can think of no system-level setting that would force line breaks.   The problem is almost certainly one of 1) The line breaks appear in the data you are outputing or 2) are introduced in the email transport mechanism, or 3) the user is doing something to the file and not telling you.

-- Dan
0
 
LVL 1

Author Comment

by:georgiek50
ID: 9763933
I have done all checking but I can't find a solution at all...I have made her a custom version of the program outputing the '|' character as a delimeter and instead of line breaks and a custom loading routine to follow those rules and remove and line breaks.  Thanks for the help, it is real hard dealing with people who has absolutely no idea about opening a simple text file and checkin if it's wrapped!!!!
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9767084
Ah, the joys of tech support!  We had to have one person print out a data file and fax it to us... because she was familiar with those operations.

Is there any way that an operator could do something that would insert line breaks into the raw data?  For instance, if it is data from a Multiline Edit control, an operator could manually insert line breaks before saving.
0
 
LVL 1

Author Comment

by:georgiek50
ID: 9767405
Yes, that is a possibility but this woman is not "clever" enough to push the button that allows the multiline edit control to be edited, I'm convinced of that.  Why read the Help file included with a program, right?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question