Reading and saving a file [message #74646] |
Wed, 26 January 2011 05:25  |
Giovanna
Messages: 12 Registered: January 2011
|
Junior Member |
|
|
Hi all,
I need to read and save a file using IDL, but my code is reading and
saving only the first line. Please, see my code:
PRO READ_FILE
OpenR, lun, 'C:\Documents and Settings\Web\IDLWorkspace\Projeto_Estudo
\dados.dat', /Get_lun
file = ''
ReadF, lun, file
SAVE, FILENAME=('C:\Documents and Settings\Web\IDLWorkspace
\Projeto_Estudo\teste1.dat')
;print,file
END
|
|
|
Re: Reading and saving a file [message #74689 is a reply to message #74646] |
Fri, 28 January 2011 03:45  |
Giovanna
Messages: 12 Registered: January 2011
|
Junior Member |
|
|
On 27 jan, 16:18, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Jan 27, 3:23 pm, David Fanning <n...@dfanning.com> wrote:
>
>>> Though I am a bit surpised at how fast Giovanna ran out of
>>> LUNs seeing she was trying to write out a single file...
>
>> Yeah, you would think a hundred or so would be enough,
>> but it never is. ;-)
>
> I got very annoyed by the low limit when working with several
> IDL_Savefile objects. Apparently they also used some limited unit
> number. I intended to keep an array of those objects, to access
> whatever file the application needed. But because of the limit I had
> to revert to creating the objects on demand, on each access.
> Fortunately, the application only had to do occasional large accesses,
> not frequent small reads.
Hello,
Me again....same topic
I'm trying read two files and to save in other file. See my code:
http://pastebin.com/GRmNtags
I run a command restore, to restore the file .sav and .cnj.... and
then saved in 'data.dat' using 'printF'
Is this correct what I did in rows 16 to 23??
Thanks,
|
|
|
Re: Reading and saving a file [message #74702 is a reply to message #74646] |
Thu, 27 January 2011 10:18  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jan 27, 3:23 pm, David Fanning <n...@dfanning.com> wrote:
>> Though I am a bit surpised at how fast Giovanna ran out of
>> LUNs seeing she was trying to write out a single file...
>
> Yeah, you would think a hundred or so would be enough,
> but it never is. ;-)
I got very annoyed by the low limit when working with several
IDL_Savefile objects. Apparently they also used some limited unit
number. I intended to keep an array of those objects, to access
whatever file the application needed. But because of the limit I had
to revert to creating the objects on demand, on each access.
Fortunately, the application only had to do occasional large accesses,
not frequent small reads.
|
|
|
Re: Reading and saving a file [message #74703 is a reply to message #74646] |
Thu, 27 January 2011 09:54  |
Giovanna
Messages: 12 Registered: January 2011
|
Junior Member |
|
|
On 27 jan, 15:23, David Fanning <n...@dfanning.com> wrote:
> Paolo writes:
>> Well someone has to give some bad advice here from time to time
>> to ensure that this place does not die off for lack of posts :)
>
>> Though I am a bit surpised at how fast Giovanna ran out of
>> LUNs seeing she was trying to write out a single file...
>
> Yeah, you would think a hundred or so would be enough,
> but it never is. ;-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Hi,
The program stoped to show that message: OPENR: All available logical
units are currently in use.
Thanks
|
|
|
Re: Reading and saving a file [message #74704 is a reply to message #74646] |
Thu, 27 January 2011 09:23  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paolo writes:
> Well someone has to give some bad advice here from time to time
> to ensure that this place does not die off for lack of posts :)
>
> Though I am a bit surpised at how fast Giovanna ran out of
> LUNs seeing she was trying to write out a single file...
Yeah, you would think a hundred or so would be enough,
but it never is. ;-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Reading and saving a file [message #74705 is a reply to message #74646] |
Thu, 27 January 2011 09:18  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
On Jan 27, 11:42 am, David Fanning <n...@dfanning.com> wrote:
> Giovanna writes:
>> This error is occurring when running:
>
>> Error -
>> OPENR: All available logical units are currently in use.
>> % Execution halted at: READ_FILE 3 read_file.pro
>> % $MAIN$
>
>> This error is occurring this line: OpenR, lun, 'dados.dat', /Get_lun
>
>> What could be??
>
> That could be using CLOSE instead of FREE_LUN to
> close your file. :-)
Well someone has to give some bad advice here from time to time
to ensure that this place does not die off for lack of posts :)
Though I am a bit surpised at how fast Giovanna ran out of
LUNs seeing she was trying to write out a single file...
Ciao,
Paolo
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Reading and saving a file [message #74706 is a reply to message #74646] |
Thu, 27 January 2011 08:42  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Giovanna writes:
> This error is occurring when running:
>
> Error -
> OPENR: All available logical units are currently in use.
> % Execution halted at: READ_FILE 3 read_file.pro
> % $MAIN$
>
> This error is occurring this line: OpenR, lun, 'dados.dat', /Get_lun
>
> What could be??
That could be using CLOSE instead of FREE_LUN to
close your file. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|