Menu

Questions about IO

Help
Abel
2024-04-10
2024-04-11
  • Abel

    Abel - 2024-04-10

    Why can't (open "fault.dat" fault "w")(printout fault "str" crlf)(close fault) write the string to the file?

     
  • Gary Riley

    Gary Riley - 2024-04-10

    If the open function returns FALSE, the file wasn't opened. This can occur if you attempt to open a file to write in a write-protected directory.

     
  • Abel

    Abel - 2024-04-11

    Well, I just tried it again at clipside. I found that printout, when executed, generates a fault.dat in this folder.And even though I included the path in the first argument to open, I still can't write str to where I want it to go. Why ? If I can't write str to another folder, then when I design an interactive page in C# and reference clips.net,env.run(), where does such printout write str? How do I return such a str to a C# Textbox?

     
    • Gary Riley

      Gary Riley - 2024-04-11

      Here's an example of writing and reading to a file from the Windows CLIPSIDE. If you provide a complete example of the exact commands you used and the output of those commands, it might be possible to determine why it's not working.

                                 CLIPS (6.4.1 4/8/23)
      CLIPS> (open "c:/users/garyriley/desktop/fault.dat" fault "w")
      TRUE
      CLIPS> (printout fault "str" crlf)
      CLIPS> (close fault)
      TRUE
      CLIPS> (open "c:/users/garyriley/desktop/fault.dat" fault)
      TRUE
      CLIPS> (read fault)
      str
      CLIPS> (close fault)
      TRUE
      CLIPS> 
      
       

Log in to post a comment.