Solved

Text file gets word wrapped somehow on it's own

Posted on 2003-11-13
7
222 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

937 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

15 Experts available now in Live!

Get 1:1 Help Now