Solved

Text file gets word wrapped somehow on it's own

Posted on 2003-11-13
7
223 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

821 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