How can I pass a file refnum into and out of external c++ code? What type does it convert to in c++?

I am trying to write external c++ code that will read a file already opened by Labview and therefore assigned a refnum. (Unfortunately, I definately can't use the standard Labview vis.) However I am not sure what c++ type to use in order to manage the refnum.
All help and thoughts appreciated. Thanks,
Joanna

You could do ALL your file handling in C or C++ (MFC CFile for
example) and pass Microsoft file handles into and out of LabVIEW
instead of LabVIEW file references into and out of C. This may be an
easier way to attack the problem.
You could create a DLL in MSVC that exports a FileOpen function, a
FileClose function and a FileRead and/or FileWrite Function and then
call that DLL from place to place as required in your code.
It would help us if you would explain what kind of data you are trying
to read or write and what the application is. Is it binary data?
text files? Do you need some special Win32 file system feature like
file mapped memory? I guess what I am asking is what is your
motivation for doing file handling in C or C++?
Douglas De Clue
LabVIEW developer
[email protected]
"Rolf" wrote in message news:...
> A LabVIEW file refnum is an internal Magic Cookie to LabVIEW and there is no
> way to directly extract the actual information assigned to that Magic
> Cookie.
> However the CIN Reference Manual describes one function which allows to
> retrieve a lower level "File" handle and at least on Windows 32 bit and
> LabVIEW
> from version 5 up to and including 6.1 this "File" LabVIEW datatype directly
> maps
> to the Win32 API "FILE" Handle.
>
> The function to use is
>
> MgErr FRefNumToFD(LVRefNum refNum, File *fdp);
>
> It is declared in extcode.h or one of its dependant headers and exported
> from "labview.lib"
> all located in the cintools directory and you can link this lib also to a
> normal DLL project.
> However calling this DLL then from any other process than LabVIEW or a
> LabVIEW
> executable will not initialize the DLL anymore correctly.
>
> Your best option if you need to write in C(++) should be to use the LabVIEW
> file manager
> functions described on the External Code Manual (manual/lvexcode.pdf) on
> this File handle.
> If you need to use directly some Win32 API functions with it please note
> that although currently
> the "File" in the LabVIEW file manager functions matches the FILE in Windows
> 32 bit API
> functions this is an undocumented and hence unsupported feature. The next
> LabVIEW version
> may actually use a different datatype for its "File" parameter to the
> LabVIEW file manager calls
> and your use of assuming File == FILE may simply crash.
>
> Also operating on a file refnum in LabVIEW which has been accessed directly
> with Win API
> functions may result in strange behaviour such as the file read/write mark
> not being updated as
> you would maybe expect it.
>
> "Jo" wrote in message
> news:50650000000800000016520000-1023576873000@exch​ange.ni.com...
> > How can I pass a file refnum into and out of external c++ code? What
> > type does it convert to in c++?
> >
> > I am trying to write external c++ code that will read a file already
> > opened by Labview and therefore assigned a refnum. (Unfortunately, I
> > definately can't use the standard Labview vis.) However I am not sure
> > what c++ type to use in order to manage the refnum.
> > All help and thoughts appreciated. Thanks,
> > Joanna

Similar Messages

  • How can i call this file path into my bsp-html  to display the images?

    Hi
    I have a file path for an image like c:/test_logo.bmp.
    How can i call this file path into my bsp-html  to display the images?
    moosa

    Try this...
    Can i have  sample code in BSP-HTML to display images?

  • I have powerpoint for Mac on my imac.  I can't seem to get the active text box function to work like it did on my PC.  How can I insert an active textbox into a presentation that will allow me to type while presenting?

    I have powerpoint for Mac on my imac.  I can't seem to get the active text box function to work like it did on my PC.  How can I insert an active textbox into a presentation that will allow me to type while presenting?

    I've gotten a little further on this. The dynamic select is
    working fine. It's the "a href" code that isn't. I'm wondering if
    someone can look at this line and tell me if it's okay to build the
    query string this way. The storeid comes through fine but I'm still
    not getting the employeeid value to pass. Here's line that's not
    working:
    td><a href="registerStoreCust.php?storeid=<?php echo
    $row_storeRS['storeid']; echo "&employeeid="; echo
    $_GET['employeeLM']; ?>">Register
    Customer</a></td>

  • How can you determine a file creation date and know if it's been altered since the creation date

    I need to know how to determine a file creation date on an ipad.  If someone creates a document/note on an ipad how can you tell when it was created and if it has been altered since?

    Unless you are using a third party app that provides that functionality, in iOS the only thing youcan access is the last edit/save date and time, which is fairly evident in the user interface for documents and notes. Some apps that handle MS Office files may provide that, but ican't say first hand.

  • I'm new to the Apple products. How can I view pdf files since Apple and Adobe don't play together?

    I'm new to the Apple products. How can I view pdf files and videos since Apple and Adobe don't play together? Also, what operating system does the iPhone use? I'm a Windows person.

    You may want to download and read the manual for your phone. It may answer a lot of the basic questions.
    http://support.apple.com/manuals/#iphone
    There is an app on your phone called "Mail". Yes, it's for reading your email.
    Best of luck.

  • How can I create a file brows menu and save option?

    How can I create a file brows menu, if I wont my user to choose a picture from his PC.
    And how can I save my user settings?(this is application going to be only on my users pc)

    You can launch a file selection dialog with FileReference. You can save settings using a SharedObject (like a cookie).
    http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_7 .html
    http://livedocs.adobe.com/flex/3/html/help.html?content=lsos_3.html
    http://livedocs.adobe.com/flex/3/html/help.html?content=lsos_5.html
    If this is a Flex app, you will only be able to select a file from the local machine and upload to server, you won't be able to open the file in the Flex app, due to security sandbox.
    If this is an AIR app you will not have this restriction.
    If this post answers your question or helps, please mark it as such.

  • How can I store a File object into a Vector and get it back

    hi there
    I need to store a number of File object into a Vector first, and later on I need to get each File object out and work with it.
    Vector mylist;
    File[] myfile;
    ....get a list of files from using File Chooser
    mylist = new Vetor();
    for (i=0;i<myfile.length;i++){
    mylist.add(myfile);
    ..how do I get them back? i try to do this way
    for (i=0;i<mylist.size(); i++)
    File tempfile = mylist.get(i);
    ..work with tempfile. but I got java.lang.object error: imcompatible types. what can I do?

    Vector mylist;
    File[] myfile;
    ....get a list of files from using File Chooser
    mylist = new Vetor();
    for (i=0;i<myfile.length;i++){
    mylist.add(myfile);
    ok try this: i don't reall understand what your trying to do though...
    File[] files;
    // get files
    Vector fileList = new Vector();
    for (int i = 0; i < files.length; i++)
      fileList.add(files);
    // to get them out.
    for (int i = 0; i < fileList.size(); i++)
    ((File)fileList.elementAt(i)).toString();
    // or
    // to get them out.
    for (int i = 0; i < fileList.size(); i++)
    File temp = (File)fileList.elementAt(i);
    System.out.println(temp.toString);

  • How can I import mpeg files downloaded into itunes?

    How can I import mpeg song files downloaded into itunes?

    Where are your MPEG stored?
    I have hundreds of old MPEGs stored in my nexternal drive, but unfortunatly i was not able import them into iMovie. I did the following trick: I created a new set of a folder and subfolder and called it "Virtual_CAM/DCIM" and saved it on my desktop. Then went to Disk Utilities>File Menue>New>Disk Image from Folder. Then selected the folder on my desktop and clicked enter. I moved the .dmg file to my external (or just keep it on your desktop). I clicked on the .dmg file. It shoud be visible on the Finder. Open your Imovie and import as you do from your camera.

  • How can I search for files in System and Library folders

    This arrose when I tried to find Archive Utility.app. Neither a Finder search or Spotlight found it, apparently because it is in Hard Drive/System/Library/CoreServices and the System folder is not searched. I've had similar problems when trying to find things in Library. How can I search these folders?

    You can enable the Finder to include System files in its search
    In a Finder finder window select Kind then Other… locate System files in the list and click the checkbox.

  • How can an add-on like Firesheep access and execute an external program like Winpcap? Is that a security flaw in Firefox?

    I have been reading about the Firesheep add-on that allows the user to hijack sessions of users on the network by stealing the cookie. I understand that to prevent any application from stealing the cookie, the cookie should not be passed by the site without SSL. However, my understanding of how Firesheep works is that it interfaces with Winpcap (a network sniffer). So my question is "How can an add-on execute an external program or operating system command like Winpcap?" Can any add-on do this and should I be extremely afraid of downloading any add-on because of the potential that it could have complete access to my system?

    Hi Scott-L.
    You asked a very good question and it turns out you're right.
    However, one must be aware that download an Addon on another website that Mozilla may be dangerous. Indeed, the Addons found on the Addon Center are checked (roughly).
    In addition, Firefox includes a blacklist that blocks addons identified as malicious.
    More information here: [http://www.computerworld.com/s/article/9193420/Mozilla_No_kill_switch_for_Firesheep_add_on?taxonomyId=17&pageNumber=1]

  • How can i transform a file stream into a stream of a block blob to download block blobs?

    I want to change this code to work with block blobs, but I can't seem to figure it out on my own
    // initialize the http content-disposition header to
    // indicate a file attachment with the default filename
    System.String disHeader = "Attachment; Filename=\"" + "sample.txt" +
    Response.AppendHeader("Content-Disposition", disHeader);
    // Download the blob to a file stream.
    using (FileStream fs = new FileStream(this.Server.MapPath(@"Data\data.txt"), FileMode.Open))
    int chunkSize = 4096;
    byte[] buffer = new byte[chunkSize];
    int read = 0;
    Response.AddHeader("Content-Length", fs.Length.ToString());
    do
    read = fs.Read(buffer, 0, chunkSize);
    Response.OutputStream.Write(buffer, 0, read);
    } while (read > 0);
    fs.Close();
    fs.Dispose();
    Response.End();

    Hi,
    What detailed scenario do you want to achieve? If you want to download files from block blob stream, please have a look at below article.
    #http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs/
    If I misunderstand, please feel free to let me know.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I import JVC files (.mod) into iMovie?

    I have an JVC Everio GZ-MC500E Camcorder which generates .mod files. These files can not be read or imported by iMovie. Does anyone know a work around? Is there any other apple program (shareware) that is able to import and convert these files?

    DVD/iMovie work with firewire connected miniDV/D8 only.
    Your mod files need a conversion but it may lose some quality.
    You'll need:
    MPEG Streamclip 1.5.1 (free) and the MPEG-2 Playback Component ($20 from Apple).
    http://www.alfanet.it/squared5/mpegstreamclip.html
    http://www.apple.com/quicktime/mpeg2/
    Sue
    iMac ppcG5 1.8 GHz 20FP & (2)iMac G4 800MHz 17FP Mac OS X (10.3.9) OS X 10.4.8 / iLife 4,5,6 Superdrives & 1 G RAM / QT6 pro

  • How can I pass a variable between JSP and Role Form

    I need to pass a variable from (a copy of) applicationmodify.jsp to the IDM Role Form so that the variable is available within the Role Form at display. We've tried getAttribute and setAttribute modifying both the Role Form and the applicationmodify JSP and can get the form to the role form but not accessible but have had no other success. Has anyone had any success in doing this? Any suggestions would be appreciated.

    if by _root level you mean you're loading something into
    _level0 you can't won't be able to use the localconnection. the
    sharedobject is your only option.

  • How can i transfer mp3 files to itunes and then onto my phone. I tried clicking the add file button but it wont do anything . Please Help

    I have been trying to add some mp3 files to my phone but i cant even get them into itunes. I tried clicking Control O which brings up the page where it shows a screen that tells you to pick your audio files but whenever i click them the songs will not download to itunes. The songs that i already have on itunes wont go to my phone even if i try and sync them . Please help and Thank You in advance.

    For how to sync:
    iTunes: Syncing media content to iOS devices and iPod       
    To import media into your iTunes library on the computer go to iTunes>Help>iTunes Help>Add items to iTunes and follow the instructions

  • How can I see all files I have checked out?

    Is it possible to automatically check-in everything I
    currently have checked out with Dreamweaver? At work I have a very
    large site with hundreds of files in a complex directory structure.
    I probably have a dozen or so files currently checked out. Would be
    nice to just check in everything so I know I'm not preventing my
    co-workers from working on any files I accidentally left
    checked-out. Thanks!

    Give OmniDiskSweeper a try.

Maybe you are looking for