Solved

Carrige return check!

Posted on 1997-09-05
3
184 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
[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
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
kellyjj earned 50 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Here's how to start interacting with our community through Post.
Popular third-party chat platforms like Slack, Discord, and Telegram are just a few of the many new productivity applications that are being hijacked by cybercriminals to create command-and-control (C&C) communications infrastructures for their malw…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 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