FYI TDMS open and read on empty file gives no error's out

I found that if you 'open' an empty (0 byte) file using TDMS open, you will not get any error messages when you open it, nor when you call functions such as "Get properties" or "List content", also no error when you close the TDMS file.
If the file is non-empty, but not a valid TDMS file, TDMS open returns an error.
I would have expected that I would get an error or a warning at least when trying to read a non-existant property or group, if not by the open function itself?!
The 2013 snippet below creates a 1-byte or empty file in the local user temporary folder, closes the file, then attempts to open and read it as a TDMS file.  The temporary file is deleted afterwards.
If the file is empty, NO errors or warnings occur at any point.  If the file is not empty, it fails on the TDMS open. (Note the sequence structure is because the path out of the tdms close is invalid if the tdms open failed.
This could conceivably cause an issue if your program does not do additional fault checking to catch existing but empty files.  (Which of course shouldn't ever happen, but in some situations it could happen.)
QFang
CLD LabVIEW 7.1 to 2013

Hooovahh
I asked to list the channels in a named group.  If that named group did not exist, I would think that should at least be a warning,  but I could see how it should not be an error, it was just unexpected to me that reading a non existant group (in an empty file) did not indicate any issues at all.   To me, 'error out' should give a warning or an error if something unexpected happened, but I may just have stricter opinion on something that by nature is very philosophical and open for debate. (And there are always tradeoffs, overt checks and bounds in a function obviously leads to overhead, and TDMS is optimized for performance, so that may be one reason it is the way it is.)
(This situation came up for me because when a file is first created, we datetime tag it and write a bunch of other meta-data to the file, then later (and over time) we add the spectrum goup + data.  [Edit] actually, in the old code, if the file existed, it was assumed to have been setup correctly. so if the group exists, the old code assumed all the meta data has already been written [end edit].. One of the many fixes possible, I'll rely on the 'found' boolean output of the parameter read instead of relying on the error/warning. If the datetime tag is found, the code will asume the file exists and has been filled with the meta data I expect.)
Thoult ::  I wasn't sure, but in either case, my intent was to provide extra information, not 'knock you' for participating in the discussion, I hope thats not how I came accross.  English is a second language to me, so I sometimes come across 'wrong' from what I mean.
QFang
CLD LabVIEW 7.1 to 2013

Similar Messages

  • Hi... I would like to purchase a Tablet Sony Xperia Z 2 10.1 (the last one of the Z series) and I was told that Adobe does not support Sony anymore.... I need to be able to open and read Adobe PDF files and I would like to know if this tablet can still us

    Hi... I would like to purchase a Tablet Sony Xperia Z 2 10.1 (the last one of the Z series) and I was told that Adobe does not support Sony anymore.... I need to be able to open and read Adobe PDF files and I would like to know if this tablet can still use Flash Player...
    Is there anyo who can help me with this? I asked in the shop and I was told "yes of course" , but when I contacted Sony directly I was advised to check with Adobe as apparently in the recent months Adobe and Sony haven't been getting along anymore...

    You may be mixing up two entirely different Adobe products.
    1. Adobe Flash Player. Needed to view web pages designed with Flash. Not needed to view PDF files. Not available for Android (not just Sony).
    2. Adobe Reader. Reads PDF files. However, the Android can also read most PDF files without needing Adobe Reader.

  • Open and read from text file into a text box for Windows Store

    I wish to open and read from a text file into a text box in C# for the Windows Store using VS Express 2012 for Windows 8.
    Can anyone point me to sample code and tutorials specifically for Windows Store using C#.
    Is it possible to add a Text file in Windows Store. This option only seems to be available in Visual C#.
    Thanks
    Wendel

    This is a simple sample for Read/Load Text file from IsolateStorage and Read file from InstalledLocation (this folder only can be read)
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Windows.Storage;
    using System.IO;
    namespace TextFileDemo
    public class TextFileHelper
    async public static Task<bool> SaveTextFileToIsolateStorageAsync(string filename, string data)
    byte[] fileBytes = System.Text.Encoding.UTF8.GetBytes(data);
    StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
    var file = await local.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);
    try
    using (var s = await file.OpenStreamForWriteAsync())
    s.Write(fileBytes, 0, fileBytes.Length);
    return true;
    catch
    return false;
    async public static Task<string> LoadTextFileFormIsolateStorageAsync(string filename)
    StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
    string returnvalue = string.Empty;
    try
    var file = await local.OpenStreamForReadAsync(filename);
    using (StreamReader streamReader = new StreamReader(file))
    returnvalue = streamReader.ReadToEnd();
    catch (Exception ex)
    // do somthing when exception
    return returnvalue;
    async public static Task<string> LoadTextFileFormInstalledLocationAsync(string filename)
    StorageFolder local = Windows.ApplicationModel.Package.Current.InstalledLocation;
    string returnvalue = string.Empty;
    try
    var file = await local.OpenStreamForReadAsync(filename);
    using (StreamReader streamReader = new StreamReader(file))
    returnvalue = streamReader.ReadToEnd();
    catch (Exception ex)
    // do somthing when exception
    return returnvalue;
    show how to use it as below
    async private void Button_Click(object sender, RoutedEventArgs e)
    string txt =await TextFileHelper.LoadTextFileFormInstalledLocationAsync("TextFile1.txt");
    Debug.WriteLine(txt);
    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

  • How to open and read an external file in Dashboard widget?

    I am new to Dashboard widgets and also Javascript. I have written a widget that needs to open and read a file on the local file system. I have searched a lot and have not found any documentation or reference on the internet as to how to do this.
    I know it can be done since there is a checkbox in the widget attributes that says "Allow External File Access".
    can anyone help me out here?
    Thanks

    You need to define the AllowFileAccessOutsideOfWidget key to Yes.
    You also need to define the AllowFullAccess key.
    You may also need to define the AllowSystem key (to Yes of course).
    Mihalis.
    PS. If you cannot find any other documentation please check http://widgetbook.blogspot.com.

  • Reading from text file gives IndexOutOfBoundsException error

    Dear All
    I really need your help in doing my assignment as soon as possible
    I am reading from a text file the following data
    4231781,Ali,AlAli
    4321790,Adnan,AlAli
    using two classes first one is
    public class Student
    private String studFName;
    private String studLName;
    private String studID;
    private double assignment1;
    private double assignment2;
    private double final_exam;
    private double total;
    public String getstudfName() {
    return studFName;
    public void setstudfName(String studFName) {
    this.studFName = studFName;
    public String getstudlName() {
    return studLName;
    public void setstudlName(String studLName) {
    this.studLName = studLName;
    public String getstudid() {
    return studID;
    public void setStudID(String studID){
    this.studID = studID;
    public double getAssignment1() {
    return assignment1;
    public void setAssignment1(double Assignment1) {
    this.assignment1 = assignment1;
    public double getAssignment2() {
    return assignment1;
    public void setAssignment2(double Assignment2) {
    this.assignment2 = assignment2;
    public double getFinal_exam() {
    return final_exam;
    public void setFinal_exam(double final_exam) {
    this.final_exam = final_exam;
    public double getTotal() {
    return total;
    public void setTotal(double total) {
    this.total = total;
    Student[] students = new Student[30];
    the second is manager one which is:
    import java.io.*;
    import java.io.IOException;
    import java.util.Arrays;
    import java.util.ArrayList;
    public class manager {
    public static Student[] students = new Student[30];
    public static void main(String args[]) {
    // We want to let the user specify which file we should open
    // on the command-line. E.g., 'java TextIO TextIO.java'.
    if(args.length != 1) {
    System.err.println("usage: java manager (file_name)");
    System.exit(1);
    // We're going to read lines from 'input', which will be attached
    // to a text-file opened for reading.
    BufferedReader input = null;
    try {
    FileReader file = new FileReader(args[0]); // Open the file.
    input = new BufferedReader(file); // Tie 'input' to this file.
    catch(FileNotFoundException x) { // The file may not exist.
    System.err.println("File not found: " + args[0]);
    System.exit(2);
    // Now we read the file, line by line, echoing each line to
    // the terminal.
    try {
    String line;
    // Student[] students = new Student[30];
    while( (line = input.readLine()) != null ) {
    // System.out.println(line);
    int m = line.indexOf(",");
    int j = line.lastIndexOf(",");
    String sID = line.substring(0,m);
    String sfn = line.substring(m+1,j) ;
    String sln = line.substring(j+1);
    int n = 0;
    students[n] = new Student();
    students[n].setStudID(sID);
    students[n].setstudfName(sfn);
    students[n].setstudlName(sln);
    students[n].setAssignment1(0.0);
    students[n].setAssignment2(0.0);
    students[n].setFinal_exam(0.0);
    students[n].setTotal(0.0);
                        ++n;
    catch(IOException x) {
    x.printStackTrace();
    // Arrays.sort(Student.students);
         int length = args.length;
    System.out.println();
    // System.out.println("Sorted by stuID");
    for (int i=0; i<length; i++) {
    System.out.print("Student ID "+students.getstudid() + "|||");
    System.out.print("Student Fname "+students[i].getstudfName() + "|||");
    System.out.print("Student name "+students[i].getstudlName());
    when I comile progrma it doesn't give any error but when I run it gives me the following exception:
    java.lang.String.substring. IndexOutOfBoundsException string index out of range : -1
    as can be seen from the manager class I form the read line from readline method as follows:
    int m = line.indexOf(",");
    int j = line.lastIndexOf(",");
    String sID = line.substring(0,m);
    String sfn = line.substring(m+1,j) ;
    String sln = line.substring(j+1);
    Therefore, student ID should be read from the beggining tel the character before the comma (,) then from the character after first comma tel that before second comma will be firstname, finally the rest after second comma will be last name.
    I want my program to read all lines in the text file and put them in order as above forming the array like database record and print them all.
    Could you please Help me in this matter friends as soon as possible.
    Regards,
    Java_Hobby

    please, format you code first (select your java code and hit the code button), then post all the error log message.

  • Opening and reading a dat file

    I have a .dat file on disk that I want to read. Is there a way I can open the file without giving the whole path starting c:/dsfsd/dfs/df/sdfsdf/....

    feel slightly wierd asking this since i feel i shud
    be knowing but whats "relative path" ???a relative path is the path from where the program is running. For example, let's say you are running in c:\java\bin and your prorgram is in there, and your file is there as well, then the relative path would just be \ thats it.
    A better way to understand this is when dealing with HTML Lets say you want to make a link to a picture. Your page is located here : /site/dir1/dir2/index.html and your pictures are stored in /site/pictures/ a way to that without naming the whole site is with relative path. Therefore if you ever wanted to move your site around to another server you wouldn't need to change anything. So for this example, the relative path to, let's say pic.jpg would be ../../pictures/pic.jpg I dont know if this clears anything up. But basically the ../ is telling the computer to go up a folder everytime.
    Good luck

  • How to open and read many files from a directory and store contents in 2D array?

    I want to make a VI that opens and reads the data from various files contained in a directory (200 files each with 2 columns) and store these in a single 2D array. For file number 1 I want to store the data from both columns in the 2D array, but for files 2 to 200 I only want to store the second column of each file. Can someone please help?

    Hi Nadav,
    Thanks for your help. I have followed your instructions but i cannot get it to work. I used the LIST DIRECTORY to list the files in the directory - that works. However, how do I read each of the 200 files using READ FROM SPREADSHEET FILE without me having to manually select each of the 200 files? So, if I use LIST DIRECTORY to list all 200 files in an array, how do I get each of these to open and store the data in a 2D array? Here is what I have done (File called read_files.VI) Could you please help me? Thank you very much in advance.
    Attachments:
    read_files.vi ‏18 KB

  • How to open and read pdf and micrsoft word (.doc) files or documents

    My problem is how to use my BB 9800 software version 6.0.0.546 to read/view pdf files and microsoft office documents. I have also bought documents to go from online and have installed it on my phone, but whenever i try to open it I receive a message that it is incompactible. Any help will be greatly appreciated.

    Hi, Sammy.
    Why not install a 3rd party PDF reader and Word Doc reader to help open and read pdf and micrsoft word (.doc) files or documents? You can google it and select one whose way of processing is simple and fast to help you with the related converting work.  It will be better if it is totally manual and can be customized by users according to our own favors. Remember to check its free trial package first if possible. I hope you success. Good luck.
    Best regards,
    Arron

  • How to open and read binary files?

    How do I open and read Binary files?

    Did you  look on The Unarchiver's web site where it has a link to older versions? http://theunarchiver.googlecode.com/files/TheUnarchiver3.2_legacy.zip
    The best thing to do is ask your friends what programs they used to produce these files, or at least what format files they are producing.  Otherwise it's like being shown a car and given a bundle of 200 keys with no idea to which one to use, or even if any of them work with that car.
    Using The Unarchiver will likely not do anything because it too will not know what format files are involved, and they may not even been in an archived format.  If they sent you a Word file without telling you (a favorite of Windows users to do  -- it drives me crazy when they could have just sent them in plain text), The Unarchiver won't open them.  If it's a picture file then using Hexedit will just show you a bunch of unintelligible stuff as shown in an earlier post, though you may see a line of text providing a hint.
    As I said earlier, often .bin may be an executable program which needs another program to actually interpret it.  That's what Java is trying to do.  Still, it may think it can execute the file, but it is highly unlikely somebody would send you an executable program (and if they did I would not trust it).  For all you know it may be a Windows virus.

  • Hi,how can i change the default settings on my adobe readerX1 such that it will display all my pdf files according to their individual cover pages (as cover picture thumbnails)before i click them to open and read........i really enjoyed this feature as a

    hi,how can i change the default settings on my adobe readerX1 such that it will display all my pdf files according to their individual cover pages (as cover picture thumbnails)before i click them to open and read........i really enjoyed this feature as a default settings upon installation in previous editions of adobe reader .i use a windows 8 pc now.thank

    For sideloaded content the nook pulls the metadata from ePub file itself.  I would suggest looking at a program like Sigil or Calibre that will let you edit the metadata in the book to make it appear like you want.
    For the PDF vs ePub - No, that's the way PDFs work (think of them as graphics, not text), wheres ePubs are Web Pages - so  no you can't them to behave exactly alike without converting the files.

  • How can i open the directory/​folder and read all the files inside it in order and then close it?

    How can i open the directory/folder and read all the files inside it in order and then close it? any example would be nice.
    thanks

    In the File I/O>>Advanced File Functions Palette is a function named "List directory". This function will give you two arrays. One contains the names of all subdirectories the other the names of all files. If you want to sort them by name use the array sort function. If you want to sort them by another attribute use the File/Directory Info function to get more data. Use a cluster which contains the attribut to sort and the original index of the name. Then sort this array.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • What tool is used to open and read UCS tech support files

    Hello,
    Due to internal Infosec policies, I need to open and read UCS tech supoort files that I generate prior to sending them to Cisco TAC. Can someone tell me what tool I can use to accomplish this task? Thanks.

    Good to hear.
    Are you intending to blank out all the proprietary info?  IPs, Hostnames etc? 
    Suggest an advanced editor such as ultraEdit which can find and replace any private information.
    Robert

  • Can you use PDF Pack to open and read PDF files?

    Can you use PDF Pack to open and read PDF files?

    Hi Keith,
    PDF Pack is a conversion tool which would convert PDF to different formats and vice versa. It cannot be used for reading PDFs.
    If you want to open and read PDF file you can use Adobe Reader.
    You can download Adobe Reader from below mentioned link.
    Adobe Reader
    let me know if you have any other questions.
    Regards,
    ~Pranav

  • TS1368 I'm a PC user with an itunes account for several years. I updated my itunes and now it wont open and shows me 'missing file MSVCR80.dll,and error 7(Window error 126)' keep coming up even after re-installing itunes . What should i do?

    I'm a PC user with an itunes account for several years. I updated my itunes and now it wont open and shows me 'missing file MSVCR80.dll,and error 7(Window error 126)' keep coming up even after re-installing itunes . What should i do?

    Click here and follow the instructions.
    (98897)

  • How to read the and Write the PDF file give me the solution

    Hi all,
    How to read the and Write the PDF file give me the solution
    My coding is
    import java.io.File;
    import com.asprise.util.pdf.PDFImageWriter;
    import com.asprise.util.pdf.PDFReader;
    import java.io.*;
    import java.io.FileOutputStream;
    public class example {
    // public example() {
         public static void main(String a[])
              try
              PDFReader reader = new PDFReader(new File("C:\\AsprisePDF-DevGuide.pdf"));
                   reader.open(); // open the file.
                   int pages = reader.getNumberOfPages();
                   for(int i=0; i < pages; i++) {
                   String text = reader.extractTextFromPage(i);
                   System.out.println("Page " + i + ": " + text);
    // perform other operations on pages.
    PDFImageWriter writer = new PDFImageWriter(new FileOutputStream("c:\\new11.pdf"));
                   writer.open();
                   writer.addImage("C:\\sam.doc");
                   writer.close();
                   System.out.println("DONE.");
    reader.close();
              catch(Exception e){System.out.println("error:"+e);
              e.printStackTrace();
    I get the pdf content then it returns the string value but ther is no option to write the string to PDF, and we only add a image file to PDF,but i want to know how to wrote the string value to PDF file,
    Please give response immtly
    i am waiting for your reply.
    thanks,
    Suresh.G

    I have some question flow
    How library to use this code.
    I try runing but have not libary.
    Please send me it'library
    Thank you very much!

Maybe you are looking for

  • Problem when running a query

    Dear all,          When i run a qurey ,i got the wrong message: Cannot load query "Z1SC_O40_Q002" (data provider "DP_1": No authorization for requested service) I think i forget to add an Authorization Object for the user. Thank you ~ Best wishes!

  • 2 Queries within 1 workbook in BEx BI7.0

    Hi Experts, I know that there is a new method of creating a workbooks in BI7.0 using the Design Mode. Suppose I have put 2 queries within 1 sheet in excel (one on top of the other). I did this by inserting 2 analysis grids within the same worksheet.

  • Payables Posted Invoice Register error information (11i)

    Just to let people know, I have run across an issue on the Payables Posted Invoice Register report. What I stumbled across is that sometimes a few invoices would not print on the report. If I changed the date range, so that the date was now in the mi

  • Impact of NOT having SSO Cluster

    Hello Everyone, I wanted to understand the below points about SSO Clustering. * Impacts of NOT having SSO Cluster * Benefits of having SSO Cluster * Step by step guide available for SSO Clustering. * Is there any pre-requisite or important deadlocks

  • Import portal plug in?

    How to Import the SAP Enterprise Portal Plug-In 6.0 in R/3 systems. shah