none
generate sb programs RRS feed

  • Question

  • I will generate sb programs. I can't save the programs, so that the sb editor can read it. How can i save it?

    I will write to a file the sb-text and character code 12 (line feed) and nothing more.

    Sorry for my bad english.


    Best Regards Martin

    Friday, January 25, 2013 2:12 PM

Answers

  • How do you write the sb-program? An sb-program is a normal textfile as written by e.g. Notepad.

    Each line ends with character(13)+character(10).

    It is not nessecary to end with character(12) , I don't know if this can go wrong.


    Jan [ WhTurner ] The Netherlands

    • Marked as answer by martmen Friday, January 25, 2013 3:45 PM
    Friday, January 25, 2013 2:44 PM
    Answerer
  • with file.writeline it is ok. here a sample: BBG711

    Best Regards Martin


    the error was the chr(12)
    • Marked as answer by martmen Friday, January 25, 2013 3:42 PM
    • Edited by martmen Friday, January 25, 2013 3:44 PM
    Friday, January 25, 2013 3:42 PM

All replies

  • How do you write the sb-program? An sb-program is a normal textfile as written by e.g. Notepad.

    Each line ends with character(13)+character(10).

    It is not nessecary to end with character(12) , I don't know if this can go wrong.


    Jan [ WhTurner ] The Netherlands

    • Marked as answer by martmen Friday, January 25, 2013 3:45 PM
    Friday, January 25, 2013 2:44 PM
    Answerer
  • I can write with:

    File.AppendContents

    File.WriteLine 

    but this is more (arry write form or line-numer) as the text and chr(13)+chr(10). For SB i need a simply seq-file. No more. 

    File.WriteContents


    Best Regards Martin

    Friday, January 25, 2013 3:20 PM
  • with file.writeline it is ok. here a sample: BBG711

    Best Regards Martin


    the error was the chr(12)
    • Marked as answer by martmen Friday, January 25, 2013 3:42 PM
    • Edited by martmen Friday, January 25, 2013 3:44 PM
    Friday, January 25, 2013 3:42 PM
  • CR + LF line ending sequence indicator is standard for Windows/DOS.

    LF alone is used on UNIXes. And CR on Macs.

    Now, neither the SB IDE or an SB program care about which line ending sequence is being used on a text file.

    Although if you save the file inside SB IDE, it becomes CR + LF again!  :-P

    To get those especial ASCII code in a SB program use:

    • LF  = Text.GetCharacter(10)   -  Line Feed
    • CR = Text.GetCharacter(13)   -  Carriage Return

    I particularly prefer LF only!   ^_^


    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

    Friday, January 25, 2013 3:43 PM
    Answerer
  • Try the following program and then look in the file aaatest.sb

    CRLF=text.GetCharacter(13)+Text.GetCharacter(10)
    FI=program.Directory+"\aaatest.sb"
    CNT="this is the first line;"
    CNT=CNT+"and this is the second line."+CRLF
    CNT=CNT+"The third line after a CRLF !"
    TextWindow.WriteLine(CNT)
    
    mess=File.WriteContents(FI,CNT)
    TextWindow.WriteLine(mess)
    mess=File.AppendContents(FI,CNT)
    TextWindow.WriteLine(mess)
    
    


    Jan [ WhTurner ] The Netherlands

    Friday, January 25, 2013 3:44 PM
    Answerer