__attach_input_file Function

Attach a hosted file to the standard input stream.

Include

<libpic30.h>

Prototype

int __attach_input_file(const char *p);

Argument

p pointer to file

Remarks

This function differs from the MPLAB X IDE mechanism of providing an input file because it provides “on-demand” access to the file. That is, data will only be read from the file upon request and the asynchronous nature of the UART is not simulated. This function may be called more than once; any opened file will be closed. It is only appropriate to call this function in a simulated environment.

Default Behavior

Allows the programmer to attach a hosted file to the standard input stream, stdin.

The function will return 0 to indicate failure. If the file cannot be opened for whatever reason, standard in will remain connected (or be re-connected) to the simulated UART.

File

attach.c