Solved

Text file gets word wrapped somehow on it's own

Posted on 2003-11-13
7
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 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.

615 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