[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [TRNSYS-users] assign a n external file to a new type



Javier, 

In principle, it works in C++ just like in FORTRAN:
You have to retries the logical file number from the right parameter (an
interger) and then use that as a C file descriptor. 

For example, if your component has only one parameter, the File/Export to
C++ wizard will create a line like 

      double Logical_unit_number;
...
      Logical_unit_number=par[0];

You have to convert Logical_unit_number to integer and then use it in
commands like 

  char buffer[6000];
...
  bytesread = _read(fh,buffer,6000);

(if you use the C low level I/O). 

For this to work, your DLL must be compiled exactly in the same mode as the
TrnDll.dll of the TRNSYS package (static vs. dynamic, debug vs. release,
etc.).

If you have trouble getting it to work (i.e. the file handle is invalid in
your C DLL), you can use a combination with Michael' idea of accessing the
labels to pass filename(s), and add _open and _close statements as needed.

Werner

-----Message d'origine-----
De : trnsys-users-bounces@engr.wisc.edu
[mailto:trnsys-users-bounces@engr.wisc.edu] De la part de javier mota
Envoyé : lundi 8 août 2005 14:01
À : trnsys-users@engr.wisc.edu
Objet : [TRNSYS-users] assign a n external file to a new type

Dear all;I am Javier Mota from 3i,Madrid.
I´m programing a new component in C++.But I have a problen. I don´t Know how

I must work to make the program reads the external file when i asign it a 
parameter like logical unit in the proforma.
I will be grateful if somebody can say me something.
Thanks in advance.

_________________________________________________________________
Descarga gratis la Barra de Herramientas de MSN 
http://www.msn.es/usuario/busqueda/barra?XAPID=2031&DI=1055&SU=http%3A//www.
hotmail.com&HL=LINKTAG1OPENINGTEXT_MSNBH

_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@engr.wisc.edu
https://www.cae.wisc.edu/mailman/listinfo/trnsys-users