MVP 2022 Joe Tauser Posted December 24, 2017 MVP 2022 Report Share Posted December 24, 2017 Is there a way to tell if a file exists on an SD card before calling Write Delimited line? I want to write a header in the first line before I start filling a file with data that someone may or may not recognize. In the past I've manually triggered a Write Line that had the header text, but this seems hokey. Joe T. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted December 25, 2017 MVP 2022 Report Share Posted December 25, 2017 If I'm understanding the question correctly, could you use bit 2 in Status Messages MI of SD File Info to answer the question in a round about way? If it can't read it, then it isn't there? cheers, Aus Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted December 26, 2017 Author MVP 2022 Report Share Posted December 26, 2017 I'll give that a try and report. Joe T. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted December 26, 2017 Author MVP 2022 Report Share Posted December 26, 2017 Empirically confirmed that bit 2 of the status word does not come on if the file doesn't exist. If everything else is OK on the SD it just goes ahead and creates the file and writes the line. Joe T. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted December 27, 2017 Author MVP 2022 Report Share Posted December 27, 2017 Also, I opened the file in Notepad++ and my data string is in the middle of a huge number of NUL characters. What's up with that? Creators? Joe T. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted December 27, 2017 MVP 2022 Report Share Posted December 27, 2017 So it worked out mostly ok? In reading the help file my interpretation was that Bit 2 would be ON if the file wasn't found. Just confirming that you're finding that it is OFF with no file name match, and ON with file present? Maybe the nulls are some sort of maximum? 256 characters in total? I haven't time to play with this at present, but am curious about it for future reference. cheers, Aus Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted December 29, 2017 Author MVP 2022 Report Share Posted December 29, 2017 Talked to Dan at US tech support - he suggested SD File Utilities -> File Status function block The "A" output bit MB 39 does what I need. I just call this function before I write the data line to see if I have to call a another Write Line for the header first. Joe T. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.