Solved

Text file gets word wrapped somehow on it's own

Posted on 2003-11-13
7
221 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now