Hi Gene >>You did #include stdio.h I assume...
Yes and unistd.h etc, as I said it compiles fine in both and runs properly from the command line >>I'm thinking that because of the type you used for 'fd', that it may well >>be volatile, and out of that functions 'scope' by the time you actually do >>the above write. fd is a simple C int. Rather than being a pointer, it is an index to a look-up table (the file descriptor table) However you could be on to something, because stdin/stdout/stderr are predefined as 0,1 and 2 respectively so if the file descriptor is getting an erroneous value or losing the value it could still be pointing to a 'file', hence the print to screen Yahoo, I have cracked it. I was using the EXTRA_SETUP and EXTRA_CLEANUP macros to initiate serial connection and close and restore settings respectively. This was largely to keep the main section of code un-cluttered and easy to maintain. Doing this necessitated a global fd accessed across several functions. Changing the program flow, so that each function holds its own copy of fd, passed from the calling or called function, results in a perfectly executing component. Thank you Gene, I just needed a kick in the right direction regards ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
