[ADMB Users] ofstream for output

Mollie Brooks mbrooks at ufl.edu
Fri Sep 10 14:11:54 PDT 2010


Hurray!
For future reference:
> #include <admodel.h>  at the top of GLOBALS_SECTION worked

> #include<iostream.h> didn't work
Thanks,
Mollie

On Sep 10, 2010, at 4:55 PM, Steve Martell wrote:

> put and #include <admodel.h> in the line  before in the globals  
> section
> or #include<iostream.h>
> S
> On 2010-09-10, at 1:46 PM, Mollie Brooks wrote:
>
>>
>> Hi Steve,
>> I'm still getting this error:
>> admbponds_measurment_trial.cpp:1: error: ‘ofstream’ does not name a  
>> type
>>
>> to go with this first line of the .cpp file:
>> ofstream out_stream("/scratch/ufhpc/mbrooks/trial.txt");
>>
>> I'm wondering if it's a problem that the GLOBALS_SECTION puts this  
>> definition before #include <admodel.h>?
>> I'm wondering if <admodel.h> contains the relevant iostream info.
>> -Mollie
>>
>>
>>
>> On Sep 10, 2010, at 3:51 PM, Steve Martell wrote:
>>
>>> Almost,
>>>
>>> Try
>>>
>>> ofstream out_stream("/scratch...trial.txt");
>>>
>>> then in your code:
>>>
>>> out_stream<<variable<<endl;
>>>
>>> Steve
>>> On 2010-09-10, at 12:44 PM, Mollie Brooks wrote:
>>>
>>>> Hi all,
>>>> If you have used ofstream to do in-procedure reporting, how did  
>>>> you get it to work?
>>>> I found that it exists here
>>>> http://admb-project.org/documentation/developers/api/keywords.txt
>>>>
>>>> I tried adding
>>>> GLOBALS_SECTION
>>>> 	ofstream out_stream;
>>>> 	out_stream.open("/scratch/ufhpc/mbrooks/trial.txt");
>>>>
>>>> But I got these errors that point to the relevant lines of the  
>>>> cpp file:
>>>> admbponds_measurment_trial.cpp:1: error: ‘ofstream’ does not name  
>>>> a type
>>>> admbponds_measurment_trial.cpp:2: error: expected constructor,  
>>>> destructor, or type conversion before ‘.’ token
>>>> admbponds_measurment_trial.cpp: In member function ‘virtual void  
>>>> model_parameters::userfunction()’:
>>>> admbponds_measurment_trial.cpp:127: error: ‘out_stream’ was not  
>>>> declared in this scope
>>>>
>>>> Also, is there a way to search the history of this mailing list?  
>>>> Sorry if this question has already been covered.
>>>> thanks,
>>>> Mollie
>>>>
>>>> Mollie Brooks
>>>> Ph.D. Candidate
>>>> NSF IGERT Fellow
>>>> Biology Department
>>>> University of Florida
>>>> mbrooks at ufl.edu
>>>> www.zoology.ufl.edu/mbrooks
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at admb-project.org
>>>> http://lists.admb-project.org/mailman/listinfo/users
>>>
>>> Steve Martell
>>> s.martell at fisheries.ubc.ca
>>>
>>>
>>>
>>
>
> Steve Martell
> s.martell at fisheries.ubc.ca
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20100910/4390d524/attachment.html>


More information about the Users mailing list