Loading ...
Sorry, an error occurred while loading the content.

Best Way To Detect Text.File Is unix/DOS

Expand Messages
  • gripperusa
    I ve used the fgetbyte(#)and input$(1,#), but what am I looking for? I d Like to DO: open file.txt for input as #1 while not eof(1) c1$ =
    Message 1 of 23 , Oct 19, 2001
    • 0 Attachment
      I've used the fgetbyte(#)and input$(1,#),
      but<br>what am I looking for?<br>I'd Like to DO:<br> open
      "file.txt" for input as #1<br> while not eof(1)<br> c1$ =
      input$(1,1)<br> c2$ = input$(1,1)<br> if c1$ = ?? and c2$ = ??
      then 'UNIX goto unix2dos<br> if c1$ = ?? and c2$ = ??
      then 'DOS goto dos2unix<br> if c1$ = ?? and c2$ = ??
      then 'MAC goto mac2dos<br><br>All the files are
      Sequential Text Files.<br>Any help? - Thanks Rick
    • FrankWJ
      Beside the fact that d$(r) is based on b$ and not on a$, the asc() function can give you the ASCII value of only the left-most character in d$(r) -- which is
      Message 2 of 23 , Oct 25, 2001
      • 0 Attachment
        Beside the fact that d$(r) is based on b$ and not
        on a$, the asc() function can give you the ASCII
        value of only the left-most character in d$(r) -- which
        is always "t" if d$(r) were based on a$.<br><br>Line
        130 might better be expressed as<br><br> 130 d$(r) =
        mid$(a$,r,1)
      • FrankWJ
        I believe you are looking to test c1$=chr$(13) carriage return c2$=chr$(10) linefeed Unfortunately, I don t recall which OS creates which
        Message 3 of 23 , Oct 25, 2001
        • 0 Attachment
          I believe you are looking to
          test<br><br>c1$=chr$(13) 'carriage return<br>c2$=chr$(10)
          'linefeed<br><br>Unfortunately, I don't recall which OS creates which combination
          -- or lack thereof. For example, if c1$=chr$(13) and
          c2$<>chr$(10), then I think you're dealing with a DOS file.
        • One_Winged_Boy
          Hi, all I m possitive the CHAR13 + CHAR10 is a DOS thing. I m sure that unix only uses 13 (car-return) because a line feed is obvious after a
          Message 4 of 23 , Oct 26, 2001
          • 0 Attachment
            Hi, all<br><br>I'm possitive the CHAR13 + CHAR10
            is a DOS thing. I'm sure that unix only uses 13
            (car-return) because a line feed is "obvious" after a
            car-return.<br><br>I forgot whether MacOS uses Char13 or Char10, but I
            think they do the same as Unix. Having used all 3, I've
            had problems opening files that lack the right
            sequence... Get a hex editor and open a few Simpletext files
          • One_Winged_Boy
            http://www.fys.ruu.nl/~bergmann/compilers.htm Chipmunk basic is there, and it s
            Message 5 of 23 , Oct 26, 2001
            • 0 Attachment
              <a href=http://www.fys.ruu.nl/~bergmann/compilers.htm target=new>http://www.fys.ruu.nl/~bergmann/compilers.htm</a><br><br>Chipmunk basic is there, and it's probably where I first
              discovered it, so... explore a bit. There are a few free
              ones there if you have windows too.
            • sgrace_pobox_com
              My recollection is that UNIX uses LF (10) only without the CR (13).
              Message 6 of 23 , Oct 26, 2001
              • 0 Attachment
                My recollection is that UNIX uses LF (10) only without the CR (13).
              • duaine_bollwitt
                I have a number simple basic programs written in the process of doing engineering project calculations. They were written in Microsoft BASIC (b) in 1985-6.
                Message 7 of 23 , Nov 4, 2001
                • 0 Attachment
                  I have a number simple basic programs written in
                  the process of doing engineering project
                  calculations. They were written in "Microsoft BASIC (b)" in
                  1985-6. I'd like to convert the basic files to Chipmunk
                  Basic. The only version of "Microsoft BASIC (b)" (on
                  this Macintosh, G4, OS 9.1), crashes the OS. Can I, or
                  do I, have to purchase software to do the conversion
                  to Chipmunk Basic? -- Duaine
                • gripperusa
                  Thanks 200 rem dummy test get file name 201 x = 0 : ck$ = 202 input Enter File Name To Test ;name$ 204 if len(name$) = 0 then goto 1000 :
                  Message 8 of 23 , Nov 5, 2001
                  • 0 Attachment
                    Thanks <br> 200 rem dummy test get file name<br>
                    201 x = 0 : ck$ = ""<br> 202 input" Enter File Name
                    To Test ";name$<br> 204 if len(name$) = 0 then goto
                    1000 : 'exit<br> 210 open name$ for input as #1<br>
                    212 while not eof(1)<br> 215 ck$ = input$(1,1)<br>
                    217 x = x + 1 : print ck$;<br> 220 if ck$ = chr$(10)
                    then print : print "unix file ";x;" Characters<br> to
                    Find unix" : close #1 : sh$ = "unix2dos " + name$ + "
                    " + name$ : sys(sh$) :<br> goto 250<br> 225 if ck$
                    = chr$(13) then print : print "DOS file ";x;"
                    Characters<br>to find DOS" : close #1 : sh$ = "dos2unix " + name$
                    + " " + name$ : sys(sh$) : g<br>oto 250<br> 230
                    wend<br> 233 print "Error CKU-D.BAS Routine Unable To
                    Determine UNIX/DOS"<br> 241 close #1<br> 250 input"Enter
                    c/r to continue ";an$ : goto 200 : rem
                    again...<br>I'll work with this a while - Rick
                  • gripperusa
                    Is it intended that the newest version of Chipmunk BASIC for unix, basic-sunos, closes the Terminal Window when it EXIT - BYE?? This is different
                    Message 9 of 23 , Nov 5, 2001
                    • 0 Attachment
                      Is it intended that the newest version
                      of<br>Chipmunk BASIC for unix, basic-sunos, closes the Terminal
                      Window<br>when it EXIT - BYE?? <br>This is different than
                      sunos.basic v3.4.8b1,<br>perhaps there is something I am
                      doing?<br>Thanks - Rick
                    • One_Winged_Boy
                      Hi Duaine. Do you still have access to an old PC? I m pretty sure that before QBASIC (1990), BASIC programs were saved in tokenized mode, so you could
                      Message 10 of 23 , Nov 6, 2001
                      • 0 Attachment
                        Hi Duaine.<br><br>Do you still have access to an
                        old PC? I'm pretty sure that before QBASIC (1990),
                        BASIC programs were saved in "tokenized" mode, so you
                        could not read them from a text editor or Chipmunk
                        Basic because they look like random Junk.<br><br>The
                        only solution I know is to Open the programs in an
                        early version of BASIC, preferably BASIC(B) for DOS (on
                        a PC, regrettably --or VirtualPC if you have it and
                        do a web search for BASIC B somehow) and then save
                        it like this:<br><br>SAVE "FILENAME.BAS" ,
                        A<br><br>The "COMMA A" tells the BASIC command line to store
                        the program in ASCII, a plain text format that
                        Chipmunk basic reads.<br><br>Anyway, it takes a little bit
                        of time to make a BASIC program 100% compatible with
                        CB, but if you're not very new to CB, it's just a
                        matter of reading the EXCELLENT (IMHO) documentation
                        html for it to find syntax or function
                        replacements.<br><br>Good Luck. Post back if you want me to try and get a
                        BASIC A compiler. They used to come free with PCs until
                        about Windows 3.1
                      • gripperusa
                        Can you gosub from inside a SUB..ENDSUB? Will it see the gobal varables set in the gosub? Thanks - Rick
                        Message 11 of 23 , Nov 24, 2001
                        • 0 Attachment
                          Can you gosub from inside a SUB..ENDSUB?<br>Will it see the gobal varables set in the gosub?<br>Thanks - Rick
                        • gripperusa
                          Well I m confused.... I would have thought that once you re in a SUB...END SUB you could only work on what was passed to that SUB, some experimenting
                          Message 12 of 23 , Nov 26, 2001
                          • 0 Attachment
                            Well I'm confused....<br>I would have thought
                            that once you're in a<br>SUB...END SUB you could only
                            work on what was<br>passed to that SUB, some
                            experimenting shows<br>other wise!<br><br>I'm using sunos.basic
                            v3.48b1, I not saying <br>this is right or wrong, I'm just
                            trying to find<br>the place way through!<br><br>Its a
                            great thing Ron's done here, I hope my<br>fumbling
                            doesn't detract from that!<br><br>Thanks Rick
                          • lizard_king55
                            I know you can draw line in chipmunk basic in the mac version. Does anyone know if you can draw a line using a linear equation?
                            Message 13 of 23 , Dec 1, 2001
                            • 0 Attachment
                              I know you can draw line in chipmunk basic in the mac version. Does anyone know if you can draw a line using a linear equation?
                            • One_Winged_Boy
                              I believe the answer is no. You can set a point and you can draw a poligon or a line. Maybe you need to look at the poly instruction? Linear equations are only
                              Message 14 of 23 , Dec 8, 2001
                              • 0 Attachment
                                I believe the answer is no. You can set a point
                                and you can draw a poligon or a line. Maybe you need
                                to look at the poly instruction? Linear equations
                                are only supported under graphing calculators as far
                                as I know.
                              • hotpaw2
                                Chipmunk Basic 3.5.8, new 2002 releases are on the web site: <
                                Message 15 of 23 , Jan 29, 2002
                                • 0 Attachment
                                  Chipmunk Basic 3.5.8, new 2002 releases are on the web site:<br> <<a href=http://www.nicholson.com/rhn/basic target=new>http://www.nicholson.com/rhn/basic</a> > <br>Mac, MacOSX, wintel, and linux ports available. Bug reports welcome.<br><br>- rhn
                                • gripperusa
                                  Using sunos.basic I have this: 3200 SUB EMenu() 3202 print ;AL$ : xem = len(AL$) 3204 print Choose From Menu 3206 print 1. Append
                                  Message 16 of 23 , Feb 23, 2002
                                  • 0 Attachment
                                    Using sunos.basic<br>I have this:<br> 3200 SUB
                                    EMenu()<br> 3202 print " ";AL$ : xem = len(AL$)<br> 3204
                                    print " Choose From Menu "<br> 3206 print " 1. Append
                                    Supject At Minimum (12)"<br> 3208 print " 2. Append
                                    Subject At # Location "<br> 3210 print " 3. Edit Subject
                                    (vi) "<br> 3212 print " 4. Accept As Is (c/r) "<br>
                                    3213 print " 5. Append End Of Subject "<br> 3214 print
                                    " 6. Quit/Return To Main Menu "<br> 3216 CEM$ =
                                    INKEY$ : IF CEM$ = "" THEN GOTO 3216<br> 3218 IF CEM$ =
                                    "1" THEN GOTO 3230<br> 3220 IF CEM$ = "2" THEN GOTO
                                    3242<br> 3222 IF CEM$ = "3" OR UCASE$(CEM$) = "E" THEN
                                    GOTO 3254<br> 3224 IF CEM$ = "4" OR CEM$ = CHR$(10)
                                    THEN GOTO 3296<br> 3225 if cem$ = "5" then AL$ = AL$ +
                                    " " : goto 3250<br> 3226 IF CEM$ = "6" OR
                                    UCASE$(CEM$) = "Q" THEN run 100<br> 3228 GOTO 3216<br> 3230 '
                                    Append Subject At Minimum (12) or after first space
                                    (chr$(32))<br> 3232 xem = len(AL$) - 12<br> 3234 for r = 0 to
                                    xem<br> 3236 xem$ = mid$(AL$,12+r,1)<br> 3238 if xem$ =
                                    chr$(32) then AL$ = left$(AL$,r+12) : goto 3250<br> 3240
                                    next r<br> 3242 AL$ = left$(AL$,12)<br> 3244 input "
                                    Enter Position To Begin Append ";r$ : r = val(r$) : if
                                    r = 0 then r = xem<br> 3246 AL$ = left$(AL$,r)<br>
                                    3250 input " Append Subject (and/or) <c/r> To
                                    Continue ";cq$<br> 3252 AL$ = AL$ + cq$ : goto 3296<br>
                                    3254 open "etc.dat" for output as #1 : print #1,AL$ :
                                    close #1 : sys("vi etc.dat")<br> 3256 open "etc.dat"
                                    for input as #1 : input #1,AL$ : close #1 : goto
                                    3296<br> 3258 <br> 3296 END SUB<br> 3297 '<br> 3298 '<br>
                                    3299 '<br><br>I call it this way:<br> 572 call EMenu()
                                    : ' 021802 print " ";AL$ : input " Append Subject
                                    (and/or) <c/r> To Continue ";cq$<br><br>I am getting
                                    a error, something like:<br>"Extra Information on
                                    line 572"<br><br>am I running out of stack space or am
                                    I calling<br>this the wrong way?<br><br>Thanks -
                                    Rick
                                  • hotpaw2
                                    Chipmunk Basic 3.5.8b7, a new Sep-2002 release, is on the Chipmunk Basic web site: http://www.nicholson.com/rhn/basic MacOS X console and command-line, and
                                    Message 17 of 23 , Sep 15, 2002
                                    • 0 Attachment
                                      Chipmunk Basic 3.5.8b7, a new Sep-2002 release, is
                                      on the Chipmunk Basic web site:

                                      http://www.nicholson.com/rhn/basic

                                      MacOS X console and command-line, and MacOS Classic versions.
                                      Fixed several bugs and added matrix invert.

                                      - rhn
                                    Your message has been successfully submitted and would be delivered to recipients shortly.