Jump to content

save/read two files at once


Recommended Posts

Download File:post-5076-1151864452.viHello,

I need to save/write two files with only one file dialog and I cannot do it.

The exercice is to give a file name, save it as *.PRD file, then right after save another file *.PRS with the same name.

The same thing for load.

Another thing that I don't know: How to save a file without a dialog, when the file name is pre-defined.

Need a little help, because I am jamed and I need to go on.

See the attached file in LabVIEW 7.1. (don't have 8).

Thank you very much,

Marius

Link to comment

The Open/Create/Replace VI has a File Path input. All you have to do is wire a file path into it and you won't get the dialog. To get the actual paths you can use the File Dialog VI from the File I/O>Advanced palette for one file and then strip the extension and use the same name for the other file.

To write a file without saving simply wire a path into the File Path input.

In general, your program would probably be better off with an event structure and less locals and sequence structures. I suggest you go searching for some LV tutorials to learn more.

Link to comment

Download File:post-5076-1151934065.vi

The Open/Create/Replace VI has a File Path input. All you have to do is wire a file path into it and you won't get the dialog. To get the actual paths you can use the File Dialog VI from the File I/O>Advanced palette for one file and then strip the extension and use the same name for the other file.

To write a file without saving simply wire a path into the File Path input.

In general, your program would probably be better off with an event structure and less locals and sequence structures. I suggest you go searching for some LV tutorials to learn more.

Thank you for answering so quickly.

Because I am not an advanced LabView programmer, I tried this code, attached, very simple and I still have err 1 when I run it. I don't understand. Can somebody help me?

thank you very much,

Marius

Link to comment

Error 1 means invalid input (as the description should tell you). This probably means you typed your path into the path control and something about it is invalid. It would be better if you use the browse button to select the file you want.

If you want to create a new file, you should right click the path control and change the browsing options to a new file. Also, since your files have a specific extension, you can configure that in the browsing options as well.

Link to comment
Error 1 means invalid input (as the description should tell you). This probably means you typed your path into the path control and something about it is invalid. It would be better if you use the browse button to select the file you want.

If you want to create a new file, you should right click the path control and change the browsing options to a new file. Also, since your files have a specific extension, you can configure that in the browsing options as well.

thanks again for the help, it is very appreciated.

now, in the attached, i created a routine (has a sub, that is why there are two files) which creates a second file when a first is created.

my big trouble is that i cannot read properly these two files. i want to do it in the same way i write them, and i got an error while reading. i don't know how to deal with this error, i have tried and i have tried.

need a little help, please.

thanks,

marius

Download File:post-5076-1151981102.vi

Download File:post-5076-1151981131.vi

Link to comment

The code looks OK to me, but I don't work with files much this way.

It seems that I can get it to throw an error, though. By placing probes I could see where the error is and by reading the description I could get a general concept of the error.

Try reading the help for the Read File function. You should wire something into the Count input and not into the type input.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.