Welcome to Dream.In.Code
Become an Expert!

Join 150,182 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,123 people online right now. Registration is fast and FREE... Join Now!




Looping through records in a file

 
Reply to this topicStart new topic

Looping through records in a file, read file loop?

graeder
17 Dec, 2002 - 11:44 AM
Post #1

New D.I.C Head
*

Joined: 17 Dec, 2002
Posts: 22

I'm writing out to a file with text submitted by a form in text area with a formatted word wrap. When it writes to the file it skips every other line. Therefore, I'm having problems reading the file and displaying the output. Does anyone know how to either remove the formatting before the data is written, or loop through the file while doing a read and skipping every other line? I have the text area on the form to send the formatted word wrap to the cgi because I need line breaks when the text is displayed
User is offlineProfile CardPM
+Quote Post

klewlis
RE: Looping Through Records In A File
17 Dec, 2002 - 02:49 PM
Post #2

cur tu me vexas?
*****

Joined: 9 Nov, 2001
Posts: 1,723

hm... it's hard to say without seeing the code.

It sounds like you're getting extra invisible line breaks in your string.

chomp all the extra newlines and stuff off, and then add just your delimiting line break at the end:
CODE

$textString = chomp($inputString);
$textString .= "\n";

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 03:50AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month