This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: printf goes to serial port?


Alex Martin wrote:


Gary R. Van Sickle wrote:

<snip>


A few gaps that need filling before anything better than SWAGs can come your
way:
- Is this app a Cygwin app,

No, it is a windows app.


I am using cygwin primarily because I get the /dev/ttyS* devices.

If you're using /dev/ttyS*, then you're using cygwin1.dll. That makes it a Cygwin app. You're not going to get POSIX/Linux support from a vanilla Win32 environment. I feel obliged to mention that because of you're using the Cygwin DLL, whatever you're working on needs to comply with the Cygwin licensing scheme if you're distributing it in any way.

or is Cygwin involved only perhiperally (e.g.
you're using Cygwin make to run the MinGW toolchain),

No mingw. Using all of cygwin's make, g++, etc.


or is Cygwin not
directly involved at all and you're saying "My non-Cygwin-related app was
working fine, I changed a bunch of stuff in the app and also upgraded
Cygwin, and now the app is broke and I'm thinking Cygwin could be to blame"?

I do not think the app is broken. Somehow stdout is going to the serial port, my code relating to file descriptors (a serialio class that provides functions like open, close, read, write, flush), opening and closing the devices, etc has never changed (that is, the code is the same code since back when printf worked). Other code has changed, that is, the gui layout, function flow, etc.

Given the description so far, this is starting to sound like a case of mixed CRTs, Cygwin's and MS's. Only one can be in charge of stdin/stdout/ stderr if you expect to get sane results. And calls to CRT I/O functions have to occur entirely in one or the other to see consistent results.

- Since your app is a GUI app, where did you expect your printf()s to go?

Well, someone taught me to use cygwin in this manner, and I have been doing so for a long time, that is, I can use a cygwin window to invoke my windows app, and the cygwin console would catch printfs (stdout chatter), so you can use it as a debug console.

That's not guaranteed. It really sounds to me like you just want a way to look at some messages when they are triggered. You'd be better off with something like "OutputDebugString()" and DebugView <http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx> if the application isn't a console app. And even if it is, this could go a long way towards unraveling any mixing and matching that you may have inadvertently done with I/O and CRTs.

--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]