Problem: DLL using fclose doesn't close file unless exit Labview completly

Hello,
Do I have more than one option to do this correctly? I do not want to be forced to stop and start
my Labview application every time I want to close a file.
    Thank you,
    Christopher Lusardi

LabView is calling the DLL from a Call Function Node.
The DLL is a copy of the below code. Is there anything wrong with this code?
Christopher Lusardi
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
char file [100];
#include "my_header.h"
int create_file ()
  char Location [100] = "my_files/";
  FILE *Fptr;
  char box [50];
  int numalo = 0;
  int numdalo = 0;
  int mypid;
  int element;
  if ( gethostname (box, 50) < 0 )
    printf ("gethostname failed\n");
    return (-1);
  mypid = (int)getpid ();
  sprintf (file,"%s%s_%d",Location,box,m­ypid);
  if ( (Fptr = fopen (file,"w+")) == NULL )
    printf ("fopen () failed opening file = %s\n",file);
    return (-1);
  else
    fprinttf (Fptr,"%d\n",Number_of_items);
    fprinttf (Fptr,"^^^^^^^^^^^^^^^^^^^^^^^­^^^\n");
    for (element = 0; element < Number_of_items;element++)
      if ( vegetable [element] == 1024 )
        fprintf (Fptr,"%d %d %X %d %d %X %X %X\n",
          vegetable [element],
          fruit,
          filtered_water.tomato [element],
          filtered_water.green [element],
          filtered_water.bacteria [element],
          filtered_water.organic [element],
          filtered_water.raw [element],
          filtered_water.washed [element]);
      else
        fprintf (Fptr,"%d %d %X %d %d %d %X %X\n",
          vegetable [element],
          fruit,
          filtered_water.tomato [element],
          filtered_water.green [element],
          filtered_water.bacteria [element],
          filtered_water.organic [element],
          filtered_water.raw [element],
          filtered_water.washed [element]);
  fclose (Fptr);
  return (0);
<!--
document.write("<img id=ti751eff3a80e72ebb border=0 src=\"/img/r.gif\" height=11 width=...

Similar Messages

  • I used to have a close tab for exiting the current site I was on instead of closing all of firefox. How do I get it back?

    I used to have a close tab for exiting the current site I was on instead of closing all of firefox. It was a red box with an x in it. How do I get it back?

    Click in a blank space on a toolbar & open 'customize'. You'll find that there is a gray "x" (on my browser it's gray) that is for closing a tab. Drag it up to wherever you want on the toolbar & it should work fine.

  • Preview doesn't close file when app is "closed"

    Try this on Mountain Lion (any version):
    1. Open a JPEG or PDF file in Preview, view the file (make sure it's a scratch file that you dont mind deleting).
    2. Quit Preview.
    3. Drag the just-viewed JPEG or PDF to the Trash.
    4. Empty the Trash
    At step 4, Finder will complain you cannot empty the Trash because the item you were viewing is "still in use".
    5. Open Activity Monitor, locate Preview in the list of apps, Quit it (no need to force quit, normal quit will do).
    6. Empty trash again. This time, the trash will empty correctly.
    This is a bug. Of course, it's caused by the new "feature" of ML (and Lion) that keeps apps open after they are Quit so they can open faster (think iOS). However, clearly Preview has a bug (probably going back years) in that it clearly fails to close open files when it quits.nMy guess is this bug is old, but pre-Lion it never showed since the OS app clean up process closed the file anyway when the app quit. But today selecting "Quit" in the app menu DOESNT quit the app, and Preview sits around holding the file open, and so Trash cannot delete the file until you really, really quit Preview using Activity Monitor.
    I posted this to Apple as a bug back in Lion, then again in the (then new) Mountain Lion. It's not been fixed. So either Apple can't fix it (which is pretty sad), or they dont CARE to fix it (which is worse, given how much money they make and how much I pay for Apple products).
    Since "Squeaky wheels" get oiled, I'd appreciate if anyone else here is bugged by this to also post a bug report to Apple to try to get this annoying bug fixed.
    --Tim

    Hi Tim,
    I was having this problem with several apps wanting to stay open, so I made this script applicaiton and put it in the dock:
    tell application "System Events"
    set app_list to (name of every process whose visible is true and name is not "QuitApps" and name is not "Finder")
    end tell
    repeat with this_app in app_list
              tell application this_app to quit
    end repeat
    It has been working pretty well.
    gl,

  • Problem in creating the simulation dll using SIT 2.0.3,matlab 7.1,labview 7.1

    I am currently using SIT 2.0.3 ,using this toolkit i am trying to create the simulation DLL for labview.but i am getting the following error in matlab command window
    Error: File: C:\SimulationInterfaceToolkit\ModelInterface\basic.tlc Line: 117 Column: 7
    Undefined identifier ReleaseVersion
    Error: File: C:\SimulationInterfaceToolkit\ModelInterface\basic.tlc Line: 117 Column: 25
    The == and != operators can only be used to compare values of the same type
    Error: File: C:\SimulationInterfaceToolkit\ModelInterface\basic.tlc Line: 260 Column: 26
    Undefined identifier ReleaseVersion
    Error: File: C:\SimulationInterfaceToolkit\ModelInterface\basic.tlc Line: 260 Column: 44
    The == and != operators can only be used to compare values of the same type
    Is this a version problem?
    I am using
    Simulation interface toolkit 2.0.3
    Matlab 7.1.0.246(R14) Service pack
    Real time workshop V.6.3
    Labview 7.1
    Microsoft visual C++ 6.0
    Can anybody help me to solve this issue.

    Hi Jayasheela,
    Here are the Read Me files for different versions of Simulation Interface Toolkit. Usually, the toolkit will only work with the versions of software that are explicitly stated.
    Simulation Interface Toolkit 3.0 Readme
    The MathWorks, Inc. MATLAB® / Simulink® application software release 13.x or 14.0, 14.1, 14.2, 14.3
    The MathWorks, Inc. Real-Time Workshop® release 13.x or 14.0. 14.1, 14.2, 14.3
    Microsoft
    Visual C++ 6.0. You can use Microsoft Visual C++ .NET 2003 only if you
    installed the LabVIEW 7.1.1 maintenance release.
    National Instruments LabVIEW Real-Time Module 7.1.x for ETS Targets.
    (Optional) National Instruments LabVIEW FPGA Module 1.1.x, for customized FPGA VIs used in real-time simulations involving FPGA devices
    Simulation Interface Toolkit 3.0.1 Readme
    The Simulation Interface Toolkit (SIT) 3.0.1 updates SIT 3.0
    to support LabVIEW 8.0, the LabVIEW 8.0 Real-Time Module, and the
    LabVIEW 8.0 FPGA Module. You also can use SIT 3.0.1 with LabVIEW 7.1.x. However, you cannot install SIT 3.0.1 for both LabVIEW 8.0 and LabVIEW 7.1.x.
    Simulation Interface Toolkit 3.0.2 Readme
    The Simulation Interface Toolkit (SIT) 3.0.2 updates SIT 3.0.1
    to support LabVIEW 8.2, the LabVIEW 8.2 Real-Time Module, and the
    LabVIEW 8.2 FPGA Module. You also can use SIT 3.0.2 with LabVIEW 7.1.x or with LabVIEW 8.0.x. However, you cannot install SIT 3.0.2 for more than one version of LabVIEW on the same computer.
    This maintenance release also adds support for the following products:
    The MathWorks, Inc. MATLAB® / Simulink® application software R2006a.
    The MathWorks, Inc. Real-Time Workshop® R2006a.
    If you install SIT 3.0.2 for LabVIEW 7.1, you can use
    Microsoft Visual C++ 6.0 to convert models to model DLLs. If you
    install SIT 3.0.2 for LabVIEW 7.1.1, 8.0, 8.0.1, or 8.2, you can use
    either Visual C++ 6.0 or Visual C++ .NET 2003.
    Simulation Interface Toolkit 4.0 Readme
    The MathWorks, Inc. MATLAB® / Simulink® application software release 13.x, 14.x, or 2006a, 2006b, 2007a
    The MathWorks, Inc. Real-Time Workshop® release 13.x, 14.x or 2006a, 2006b, 2007a
    Microsoft Visual C++ 6.0 or .NET 2003
    You can also take a look at this KnowledgeBase article, which condenses some of the previous information.
    MATLAB®, Real-Time Workshop®, and Simulink® are the registered trademarks of The
    MathWorks, Inc. Further, other product and company names mentioned herein are
    trademarks, registered trademarks, or trade names of their respective companies.
    Amanda Howard
    Americas Services and Support Recruiting Manager
    National Instruments

  • Problem in using different format for Image files

    We are generating a report wherein the logo (Image File) is changed with respect to the company's location.
    Here, we are making use of a Text field using a formula column as its source for getting the file path.
    When the Size is kept as "Expand" or "Variable", then, when the image size changes considerably, it gives problem, wherein the logo is not displayed.
    Then we increased the size of the logo field and kept thte size type as Fixed. But the probnlem which we face is because of the .bmp format which the report accepts.
    This is because, when the format type is bmp, upon increasing the resolution or size of the bmp increases the size by several folds( say from 70kb to almost 1000 or 1500kb) which leads to the error "Memory cannot be read" and leads to abrupt application termination.
    Is their any way by which i can make use of GIF format for the image file and at the same time change the file name at runtime.
    Eagarly waiting for an early solution.
    Thanking you in Advance,
    Ramnath Balasubramanian

    Hi,
    You can only use one Apple ID with iTunes match. Purchasing another match subscription using wife's Apple ID is not a solution. I can only suggest that you use your ID for match and all iTunes music purchases.
    Jim

  • Quitting Preview doesn't close file

    It used to be, using Snow Leopard, that if I opened an image/pdf file in Preview and then quit the application, the next time I opened it the former image would not reappear. Now under Lion there is a new behavior: relauncing the app reopens whatever file was open when I quit. I have to consciously close each image file before quitting Preview, or face them all again, a process that is a waste of time. How can I revert to the former behavior?

    You can turn this off:
    Open System Preferences
    General (under Personal)
    Uncheck “Restore windows when quitting and re-opening apps“

  • Preview doesn't close files

    After using Preview for a  few days, it hangs while opening a new file.  That is, its window is dim and a circular icon keeps spinning  forever. The only way to interrupt this and start over is to Force Quit Preview, even though the force quit funtion des not identify preview as 'not  responding'.
    What is going on, and how does this relate to the new feature of Lion where apps retain their 'state' between executions??

    It appears to me that network file access is buggy in Maverick.
    In my case I have a USB Drive attached to airport extreme (new model) and when I open folders on that drive they all appear empty. If I right click and I select get info after a few minutes! I get a list of the content.
    It makes impossible navigate a directory tree.
    File access has been trashed in Maverick.
    They have improved (read broken) Finder. I need to manage a way to downgrade to Lion again.

  • Problems while using KXML2 to parse XML file

    I have been doing a lot of reading up on the APIs of XMLPull and KXML2.
    I seem to be facing a problem which can't be solved just by reading but rather the expertise of the more experienced programmers dealing with XML parsing in J2ME.
    I know how long it takes to process an entire XML document, I just would like to parse certain parts of the document. For e.g. instead of reading the whole document, say I just want to read the first 7 items and subsequently, the next 7 items when the user clicks on the next page?
    In other words, I wish to incorporate paging. Is it possible? Or if you have an alternative solution which will not make a user wait too long, please share it!
    Can anyone help me?

    Hi,
    I passed the full path with file name to SAXParser as follow:
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser sap = factory.newSAXParser();
    XMLReader parser = sap.getXMLReader();
    sap.parse( new File(importFile) );
    // Specify that we don't want validation. This is the SAX2
    // API for requesting parser features.
    parser.setFeature("http://xml.org/sax/features/validation", true);
    // Instantiate this class to provide handlers for the parser and
    // tell the parser about the handlers
    Import handler = new Import();
    parser.setContentHandler(handler);
    parser.setErrorHandler(handler);
    // Create an input source that describes the file to parse.
    // Then tell the parser to parse input from that source
    org.xml.sax.InputSource input = new InputSource(new FileReader(importFile));
    parser.parse(input);
    Where "importFile" is : /tmp/testFile.xml

  • InDesign won't close files

    Hallo everybody,
    I'm new her at InDesign-Scripting-Forum, but I have a great problem, and hope there is somebody out who can help me:
    My problem is that InDesign won't close files which have been opened.
    Just a little Javascript (I have reduced it to the minimum):
    var myFile="1.indd";
    // Open the file
    var myDoc=app.open(File(myFile));
    // Close the file
    myDoc.close(SaveOptions.no);
    if(app.documents.length > 0)
            alert("Still " + app.documents.length + " files opened");
    If this script starts from InDesign Javascript Panel, there are no problems or errors.
    InDesign will open the file (1.indd), and closes the file, and no alert will appear.
    But.... if the Javascript ist copied to the InDesign "startup script" folder, so that InDesign should
    run this script on InDesign Startup,the alert will appear.
    If you are running the script in a loop, just like working with 10 files of a current directory,
    InDesign will show alert of 10 opened files at the end.
    So.. at the end of the script, I want to move the (opened and closed) file to another directory.
    But when InDesign "says" the file is opened, I cannot move or rename the file.
    (It is only possible when running the script manually by the Javascript Panel).
    Can anybody help me, so that I can close the file, or that InDesign will close the file
    when running as a "startup-script"?
    Thanks very much.
    Martin.

    I have 8 MB of RAM. I restarted all the software, but not my computer.
    It is in the left column that I am having the problem.
    There was a previous discussion thread where a user on Mountain Lion was having the same issue, but it wasn't resolved in that discussion thread either.

  • I am trying to use the trial creative cloud software on a PC windows 8.1 - I've downloaded and removed Photoshop CC 2014 two times - every time I open the file it says there is a problem and it shuts down and closes. I can open indesign and maybe other ap

    I am trying to use the trial creative cloud software on a PC windows 8.1 - I've downloaded and removed Photoshop CC 2014 two times - every time I open the file it says there is a problem and it shuts down and closes. I can open indesign and maybe other apps but photoshop no. Any ideas?

    I don't think I can access the crash report? Excuse the ignorant questions I'm about to make am a relative tech novice.
    Soo - as mentioned every time I open photoshop it crashes - it just says there's an error and the program will shut down and if there's a solution windows will notify me. Then nothing...
    I've tried to look in photoshop files for the detailed crash report & the system event viewer but cannot find a file with those names. I've also looked in the windows files for files with those names but cannot find them either - so I don't know where to look.
    Any guidance would be great.

  • I have been buying apps for a long time  without a problem using my credit card on file. All of a sudden itunes is not recognizing my card which is in good standing. All the info is correct but itunes/apple says it doesn't  match the bank info. Any ideas

    I have been buying apps for a long time  without a problem using my credit card on file. All of a sudden itunes is not recognizing my card which is in good standing. All the info is correct but itunes/apple says it doesn't  match the bank info. Any ideas?

    Answered in your Other post on this Topic...
    https://discussions.apple.com/message/24053626#24053626

  • Since upgrading to 4.0 and now 5.0 tabs do not have tab close buttons and I must use CNTL-W to close open tabs, what's the problem?

    Since upgrading to Firefox 4.0 the close tab button, usually in the upper right corner of the tab has been missing. I have just recently upgraded automatically to 5.0 and the tab close 'X' button is still missing from all open tabs. The only way to close a tab is to click on it and use CNTL-W to close out the tab.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    In Firefox 4 you can use one of these to start in <u>[[Safe mode]]</u>:
    * Help > Restart with Add-ons Disabled
    * Hold down the Shift key while double clicking the Firefox desktop shortcut (Windows)
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • DDE problem (close file)

    I use Oracle Forms 6 and DDE package.
    My dde peace of code work normal and fine, but problem is: How I can work with DDE without show word document on the screen or close that document which is show on screen?
    and later unlock that file so I can cut it or delete it?
    Another question is: is there any way to formating my word template without make some macro (for ms word) in VB?
    thanks and best regards.
    mret

    Are you sure the error occurs at Close File VI?  You should put your code in highlight execution mode (the light bulb on the block diagram) and watch your error cluster wire, it will show the error in red text when it occurs, this info may help to pinpoint the issue.
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

  • Problems in using Labview DLL with TestStand!

    Hi,
    I tried to put the VI's to create a TCP/IP Connection, read/write Data to it and close it inside a LabVIEW DLL and use these functions with TestStand.
    The problem is to get access to the ConnectionID generated as TCP Network Refnum in LabVIEW.
    I don't know how to specify the prototype entry for this Refnum in LabVIEW and how to read it with TestStand.
    Another try to pass an ActiveXReference of SequenceContext and use the SetValIDispatch method to set a local variable (Type: ActiveXReference) to the returned ConnectionID of the TCPOpen.VI wasn't successful too.
    It seems to me that the connectionID isn't a normal ActiveXReference.
    Regards,
    Sunny

    Hi Sunny -
    You should treat this parameter as a pointer to an int when calling the DLL from TestStand (or any language like C or C++). Note that you can't do anything with the value outside of LabVIEW since it only has meaning inside of LabVIEW. You can only pass it around for use in other VIs you call from TestStand.
    Hope this helps....
    Kyle G.
    National Instruments
    Kyle Gupton
    LabVIEW R&D
    National Instruments

  • Problems with using a variable of type flash.filesystem.File

    I need to parse a file with my flex app.  I can import flash.filesystem.File with no problem but if I try to create a variable of that type, it does strange things at run time.  If the variable is defined inside a function, it's as if that function no longer exists.  The function doesn't get called and I can't step into it.  If I define a File variable at global scope, the swf simply won't do anything at all.
    I've added all the AIR libs to my project and don't know what else to try at this point.  Any ideas?
    This sample code shows the problem.  If I comment out the File in initData, initData doesn't get called and I can't step into it.  If I comment out the global File, then I get a blank swf.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application           
       xmlns:mx="http://www.adobe.com/2006/mxml" minWidth="955" minHeight="600"
       initialize="initData()">
        <mx:Script>
            <![CDATA[
                import flash.filesystem.File;
                //private var file:File;
                private function initData():void
                    //var file:File;  
                    testLabel.text = "test";   
            ]]>
        </mx:Script>
        <mx:TextArea y="200" id="testLabel" text="hello" />
    </mx:Application>

    sorry for my ignorance, I've only been using flex since 4.0
    shouldn't you be using WindowedApplication rather than Application for an AIR app?
    also there is no need to import File
    below is my code that work's fine
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
                                  layout="absolute"
                                  initialize="initData()">
         <mx:Script>
              <![CDATA[
                   private var file:File;
                   private function initData():void
                        var file:File;
                        testLabel.text = "test";
              ]]>
         </mx:Script>
         <mx:TextArea y="200" id="testLabel" text="hello" />
    </mx:WindowedApplication>

Maybe you are looking for

  • Apple Mini-DVI to Video Adapter doesn't fit my aluminum iMac

    I previously had a 17" white iMac (pre-Intel) machine, and about 6 months ago I bought the mini-DVI to video adapter so I could connect it to my television. Worked like a charm. But I recently bought a new aluminum iMac, and the adaptor doesn't fit i

  • Custom Report - Open Order

    Dear All, We are in a Process to Develop certain Z-Reports. One of the Z-Reports is Open Order Status, which includes following informations: Sales Office--Customer Code-Sales Order No.--Item No.Material Description-Booking Qty--Delivered QtyOpen Qty

  • [ot] A UML tool for a new Java project

    I am working on the new Java project and need a UML tool to get it start. I am wondering whether anyone one can recommend such tool or not. It can be either stand alone or as an Eclipse plug-in. It shall be able to handle at least 50 classes. Thanks.

  • oms_error Message:[oms] empty or null xml map request string.

    I'm using mapviewer. I create a stored procedure in oracle that uses the utl_http package to make the map request. The omserver response with an error but when i make a map request via internet explorer the server response its ok and show me the corr

  • How can i make a CHECK in an ALTER table, to compare 2 Variables of TWO different tab

    I have 3 tables: EVALUATION (No_expert, No_article) EXPERT (No_expert, origine, name) AUTHOR_ARTICLE (No_Article, Code_author) AUTHOR (Code_author, Name, Original) and my question is: How can i make a check to refuse each time an EXPERT ADDED to the