Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Carrige return check!

Posted on 1997-09-05
3
Medium Priority
?
189 Views
Last Modified: 2010-04-16
Hi.

I need a program that opens a acsii file.
Check the first line at chr nr 80 if there is a carrige return, if not put inn one. If there is a CR at that posistion of the first line, just close the file.
If no then put inn a CR, go to the next line and do the same.
so on, until the end of file.

When i open the file i do not know how big the file is...

Best reguards, Kim Morgan Ellis
0
Comment
Question by:troll
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
kellyjj earned 100 total points
ID: 1215548
the way I would do it would   be like this:

while (not eof(file))  do
begin
   x=x+1  
   read(file, chr)
   if x=80  and chr<>char(13)  then  "put char(13) in file"
   if x=81  and chr<> char(13) then  x=1
   if x=81 and chr=char(13) then  break
end

This is kinda psuedo code, but for it should get you down the road.   Hope this helps
0
 

Author Comment

by:troll
ID: 1215549
Thank you very much, but I've never used Pascal, is this the whole Source code?... Please help me out..

Thx, Best reguards Kim Morgan Ellis
0
 
LVL 2

Expert Comment

by:kellyjj
ID: 1215550
Kim,  
The syntax is pretty much on.  though the "" is what you want to do, not actuall code.  Take this and place it in a program and it should work.  If you know c/c++ then you should have no prob picking up the syntax for pascal.  the two are very similar.

If you have any probs or questions then e mail me.  kellyj@r2d2.bpginc.com
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Did you know there are services out there that can turn an Instagram feed into an RSS feed? I found some interesting exclusive Instagram content which I wanted to follow without signing up for yet another social media account. RSS to the rescue!
Your business may be under attack from a silent enemy that is hard to detect. It works stealthily in the shadows to access and exploit your critical business information, sensitive confidential data and intellectual property, for commercial gain. T…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

971 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