*Help* I need to make a non-standard text file standard.

*Help* I need to make a non-standard text file standard.

Post by Michel Forg » Thu, 10 Dec 1992 09:13:28



I really hope someone can help me out on this problem.  About half way into
a programmin project, I have encountered a problem that I can not seem to
get around.

I normally use Personal Pascal, but in this case that is what seems to be
causing the problem.  I need to read a non-standard text file (the lines
are seperated by 10 ($0A), which is an LF, rather than 13/10, which would
be a carriage/return LF.  The reason this is causing so many problems is that
Personal Pascal (ReadLn) expects a perfect, standard file.

So, does anyone have C source code to read in each byte of a file, and
write the data to a different file (inserting a carriage return where it
should be in the new file).  I have Sozobon C 1.33i so I will be able to
compile programs people offer.  C is not my specialty though (which you
probably guessed since I have to ask for help on such a simple problem).

I tried to write a program to do this myself (in Pascal) using the fread()
and fwrite() calls.  This gave me an excellent copy file utility, but it
would not recognize the LF.  When I looked into the actual data being used,
I got some very strange results.  It seems as if each byte in the file
buffer was representing two characters instead of one, which resulted in
numeric values that did not match when compared to what I was expecting).
When I wrote the file to the disk, though, it came out in good condition.
I would feel better doing this in C, but I'll certainly keep trying to
determine why each bytes represents two characters.

Any help would be greatly appreciated (and code would be even better).

Thanks!

--
<<  -----------------------------------------  >>

<<  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  >>
<<               Michel Forget                 >>
<<   The Key:  Spirit over mind over matter.   >>
<<  -----------------------------------------  >>

 
 
 

*Help* I need to make a non-standard text file standard.

Post by Bob_BobR_Rete.. » Sat, 12 Dec 1992 07:44:42


Michel Forget writes about wanting to convert linefeed characters
to carriage return/linefeed pairs...

A very simple way to do this is to use a wordprocessor
(like ST Writer) which has Search and Replace capabilities..

I often have to do that with files from the Amiga world (for
whatever reason, their text files are formatted like this, with
just linefeeds, no CRs), and ST Writer does it just fine.

I also use the capture buffer in Flash 1.60 which has the same
capabilities to search and replace text.

ST Writer is free, and should be available from atari.archive...

BobR

 
 
 

*Help* I need to make a non-standard text file standard.

Post by sheppar.. » Sat, 12 Dec 1992 20:55:37


Quote:>A very simple way to do this is to use a wordprocessor
>(like ST Writer) which has Search and Replace capabilities..

>I often have to do that with files from the Amiga world (for
>whatever reason, their text files are formatted like this, with
>just linefeeds, no CRs), and ST Writer does it just fine.

>I also use the capture buffer in Flash 1.60 which has the same
>capabilities to search and replace text.

>BobR

No need for any of that, just load it into Tempus and save it again,
fixes all those stuffed up Unix like Text Files...

Can some one tell me why these Programers can't uses the Standard Text Format
this is Used by the ST..??

I have even had TTP programs, that did the same thing when you asked for
the Help info, what nut ever did this..??

Lets keep to the Atari Standard...??


 
 
 

*Help* I need to make a non-standard text file standard.

Post by Christopher Brow » Sun, 13 Dec 1992 00:35:06


Thank you Roger for your useful comments.  Of course, it's not
actually Atari's standard that you're talking about - it's Microsoft's
standard.  That's where it came from.

Sometimes people have to translate between the Unix and MSDOS
delimiters.  Perhaps because they work in both environments.  Perhaps
because they're idiots that ought to know better.  Perhaps because
somene wanted to annoy people that dislike UNIX.

There's a little utility that I found at atari.archive.umich.edu
called "Flip."  It will "flip" the line delimiters from one to the
other on demand.  I recompiled it under the latest version of GCC, and
may have sent a newer copy in.  I don't remember.  If it needs to be
updated, I certainly have it around at home here, and can upload it.

Flip is happiest running under a CLI, but I have used it from the
desktop.  Not pretty there, but it does work.

Oh, by the way, Flip was written by Rahul Dhesi, notable as the
authour of the Zoo file archiver.
Here's the output of "flip -h" on my Sun account here.

File interchange program flip version 1.00.  Copyright 1989 Rahul
Dhesi,

All rights reserved.  Both noncommercial and commercial copying, use,
and creation of derivative works are permitted in accordance with the
requirements of the GNU license.  This program does newline
conversions.

   Usage:     flip -umhvtsbz file ...

One of -u, -m, or -h is required;  others are optional.  See user
manual.

   -u     convert to **IX format (CR LF => LF, lone CR or LF
unchanged,
          trailing control Z removed, embedded control Z unchanged)
   -m     convert to MS-DOS format (lone LF => CR LF, lone CR
unchanged)
   -h     give this help message
   -v     be verbose, print filenames as they are processed
   -t     touch files (don't preserve timestamps)
   -s     strip high bit
   -b     convert binary files too (else binary files are left
unchanged)
   -z     truncate file at first control Z encountered

May be invoked as "toix" (same as "flip -u") or "toms" (same as "flip -m").
--
Christopher Browne                |     PGP 2.0 key available

University of Ottawa              |  The Personal Computer:  Colt 45
Master of System Science Program  |  of the Information Frontier

 
 
 

1. non-standard 3.5" disk drive

I've just recently picked up a 3.5" disk drive (Sony MP-F52W-50, out
of an old HP 9122 dual drive "box").  I have the CSS XF551 conversion,
which should allow me to use this drive.  But it's not standard.  The
Sony expects power (+12, +5V) on the 34-pin cable, not four separate
pins.  So I wired it up correctly.  Now at least the drive spins up,
but I am unable to read, write, or format a disk.  I have the slide
switch in the right position (otherwise it doesn't even spin up on
power-up, or when I send a command to the XF551), and I'm only trying
to use DSDD (720K) disks.

Can anyone point me to schematics or documentation on this Sony unit?
Or maybe the standard 34-pin connector's pinout?

Thanks in advance!

--
Jeff Potter



2. frecover dies

3. Mtools & non-standard formatted DOS floppies on a Sun workstation

4. NFS Hangs

5. Non-standard disks in Pacifist

6. Sega SC-3000 model "H" Personal Computer, Carton and Accessories.

7. Need specs for Standard MIDI files (0 and/or 1)

8. Novell versus TCP/IP

9. Using HUGE Sio2pc disks with Spartados (non standard size)

10. NEEDED: Notator SL standard fonts.

11. Midi File Format Standard Found

12. Atari can read standard midi files..

13. Cubase Audio and Standard Midi Files