[{"data":1,"prerenderedAt":339},["ShallowReactive",2],{"/dict/file-open":3,"/dict/file-open-surround":328},{"id":4,"title":5,"body":6,"description":295,"extension":296,"meta":297,"navigation":315,"path":324,"seo":325,"stem":326,"__hash__":327},"content/dict/file-open.md","NetLogo Dictionary: file-open",{"type":7,"value":8,"toc":284},"minimark",[9],[10,11,16,35,58,129,141,144,165,177,260,266],"div",{"className":12,"id":14,"role":15},[13],"dict_entry","file-open","region",[17,18,20],"h3",{"id":19},"file-open20",[21,22,26,27],"a",{"href":23,"role":24,"ariaLabel":25},"#file-open","doc-noteref","Reference to file-open","\nfile-open\n",[28,29,34],"span",{"className":30,"role":32,"ariaLabel":33},[31],"since","note","Since version","\n2.0\n",[36,37,41],"h4",{"id":38,"className":39},"file-open-string",[40],"section-heading",[21,42,46],{"className":43,"href":45},[44],"section-anchor","#file-open-string",[28,47,50],{"className":48},[49],"prim_example",[51,52,53,54],"p",{},"file-open ",[55,56,57],"em",{},"string",[51,59,60,61,63,64,76,77,85,86,94,95,76,103,76,111,119,120,128],{},"This command will interpret ",[55,62,57],{}," as a path name to a file\nand open the file. You may then use the reporters ",[65,66,68],"primitive",{"displayText":67,"permalink":67},"file-read",[21,69,67],{"className":70,"dataDisplayText":67,"href":72,"rel":73,"target":75,"title":67},[71],"netlogo-wiki-link","/dictionary#file-read",[74],"noopener","_self",", ",[65,78,80],{"displayText":79,"permalink":79},"file-read-line",[21,81,79],{"className":82,"dataDisplayText":79,"href":83,"rel":84,"target":75,"title":79},[71],"/dictionary#file-read-line",[74],", and ",[65,87,89],{"displayText":88,"permalink":88},"file-read-characters",[21,90,88],{"className":91,"dataDisplayText":88,"href":92,"rel":93,"target":75,"title":88},[71],"/dictionary#file-read-characters",[74]," to read in from\nthe file, or ",[65,96,98],{"displayText":97,"permalink":97},"file-write",[21,99,97],{"className":100,"dataDisplayText":97,"href":101,"rel":102,"target":75,"title":97},[71],"/dictionary#file-write",[74],[65,104,106],{"displayText":105,"permalink":105},"file-print",[21,107,105],{"className":108,"dataDisplayText":105,"href":109,"rel":110,"target":75,"title":105},[71],"/dictionary#file-print",[74],[65,112,114],{"displayText":113,"permalink":113},"file-type",[21,115,113],{"className":116,"dataDisplayText":113,"href":117,"rel":118,"target":75,"title":113},[71],"/dictionary#file-type",[74],",\nor ",[65,121,123],{"displayText":122,"permalink":122},"file-show",[21,124,122],{"className":125,"dataDisplayText":122,"href":126,"rel":127,"target":75,"title":122},[71],"/dictionary#file-show",[74]," to write out to the file.",[51,130,131,132,140],{},"Note that you can only open a file for reading or writing but not\nboth. The next file i/o primitive you use after this command\ndictates which mode the file is opened in. To switch modes, you\nneed to close the file using ",[65,133,135],{"displayText":134,"permalink":134},"file-close",[21,136,134],{"className":137,"dataDisplayText":134,"href":138,"rel":139,"target":75,"title":134},[71],"/dictionary#file-close",[74],".",[51,142,143],{},"Also, the file must already exist if opening a file in reading\nmode.",[51,145,146,147,155,156,164],{},"When opening a file in writing mode, all new data will be appended\nto the end of the original file. If there is no original file, a\nnew blank file will be created in its place. (You must have write\npermission in the file’s directory.) (If you don’t want to\nappend, but want to replace the file’s existing contents, use ",[65,148,150],{"displayText":149,"permalink":149},"file-delete",[21,151,149],{"className":152,"dataDisplayText":149,"href":153,"rel":154,"target":75,"title":149},[71],"/dictionary#file-delete",[74]," to delete it first, perhaps\ninside a ",[65,157,159],{"displayText":158,"permalink":158},"carefully",[21,160,158],{"className":161,"dataDisplayText":158,"href":162,"rel":163,"target":75,"title":158},[71],"/dictionary#carefully",[74]," if you’re not sure\nwhether it already exists.)",[51,166,167,168,176],{},"Note that the string can either be a file name or an absolute file\npath. If it is a file name, it looks in whatever the current\ndirectory is. This can be changed using the command ",[65,169,171],{"displayText":170,"permalink":170},"set-current-directory",[21,172,170],{"className":173,"dataDisplayText":170,"href":174,"rel":175,"target":75,"title":170},[71],"/dictionary#set-current-directory",[74],". It is defaulted\nto the model’s directory.",[178,179,180],"pre",{},[181,182,183,188,189,193,196,188,200,204,206,188,211,188,215,188,219,188,223,188,227,232,234,188,237,241,243,247,249,188,252,188,256],"code",{},[28,184,14],{"className":185},[186,187],"token","command"," ",[28,190,192],{"className":191},[186,57],"\"my-file-in.txt\"",[194,195],"br",{},[28,197,199],{"className":198},[186,187],"print",[28,201,79],{"className":202},[186,203],"reporter",[194,205],{},[28,207,210],{"className":208},[186,209],"variable","=>",[28,212,214],{"className":213},[186,203],"First",[28,216,218],{"className":217},[186,209],"line",[28,220,222],{"className":221},[186,209],"in",[28,224,226],{"className":225},[186,209],"file",[28,228,231],{"className":229},[186,230],"comment",";; File is in reading mode",[194,233],{},[28,235,14],{"className":236},[186,187],[28,238,240],{"className":239},[186,57],"\"C:\\NetLogo\\my-file-out.txt\"",[194,242],{},[28,244,246],{"className":245},[186,230],";; assuming Windows machine",[194,248],{},[28,250,105],{"className":251},[186,187],[28,253,255],{"className":254},[186,57],"\"Hello World\"",[28,257,259],{"className":258},[186,230],";; File is in writing mode",[51,261,262,263,265],{},"Opening a file does not close previously opened files. You can use ",[181,264,14],{}," to switch back and forth between multiple open\nfiles.",[51,267,268,269,275,276,140],{},"See also ",[65,270,271],{"displayText":134,"permalink":134},[21,272,134],{"className":273,"dataDisplayText":134,"href":138,"rel":274,"target":75,"title":134},[71],[74]," See also ",[65,277,279],{"displayText":278,"permalink":278},"file-close-all",[21,280,278],{"className":281,"dataDisplayText":278,"href":282,"rel":283,"target":75,"title":278},[71],"/dictionary#file-close-all",[74],{"title":285,"searchDepth":286,"depth":287,"links":288},"",5,3,[289],{"id":19,"depth":287,"text":290,"children":291},"\nfile-open\n\n2.0\n",[292],{"id":38,"depth":293,"text":294},4,"file-open string","Documentation for the file-open primitive.","md",{"source":298,"metadataOutputPath":299,"projectConfig":300,"language":307,"inheritFrom":316,"output":315,"version":301,"layout":317,"dictionaryDisplayName":318,"dictionaryHomeDirectory":319,"indexFileURI":320,"currentItemId":14,"currentItemLabel":14,"primRoot":321,"icon":322,"assetsRoot":323},"autogen/dict/file-open.md","content/dict/file-open.metadata.yaml",{"version":301,"projectRoot":140,"scanRoot":302,"outputRoot":303,"defaults":304,"engine":310,"partials":311,"dedupeIdenticalDiskWrites":315},"7.0.4","autogen","content",{"inheritFrom":305,"language":307,"output":308,"extension":296,"title":309,"version":301},[306],0,"en",false,"NetLogo User Manual","handlebars",{"directoryPaths":312,"extensions":313},[140],[314,296],"mustache",true,[306],"catalog","NetLogo Dictionary","/dictionary.html","/_index/dict.txt","dict","i-lucide-square-code","/home/runner/work/Helio/Helio/apps/docs/autogen","/dict/file-open",{"title":5,"description":295},"dict/file-open","F8otahWlxgzpe7eOJT117lCe18m4i8TDYHE9W9_AEvw",[329,334],{"title":330,"path":331,"stem":332,"description":333},"NetLogo Dictionary: file-flush","/dict/file-flush","dict/file-flush","Documentation for the file-flush primitive.",{"title":335,"path":336,"stem":337,"description":338},"NetLogo Dictionary: file-print","/dict/file-print","dict/file-print","Documentation for the file-print primitive.",1777657807845]