Right, so I'm fairly new to C and have worked in several high-level languages for a few years. Now I've been able to google and work with what I could find, but I have a few questions now. I'm working on a DLL that outputs information. Now I can store the information in a file but I'd like to be able to read it actively and have cross program communication and the like. The DLL is for a friend whose working in a high-level language. Now that you know the backstory.

How would I attachconsole in C to an existing process. With a DLL is their a parent-child connection to programs. How can I getch/getchar() with a DLL to pause or start output, and is there a good site I can go to for information about C functions. Almost all sites I find are C++.

Hi, I'm afraid I couldn't really find any C questions in your post, which is probably why you're having a hard time acquiring answers them by looking for information about C functions.

You ask "how would I attachconsole in C to an existing process". I'm not even sure what this means. At a guess I am thinking you want a program that can read/write to the "console" of another process? Unfortunately, C itself has no concept of processes or consoles. A C program has three pre-opened streams called standard input (stdin), standard output (stdout), standard error (stderr). Which devices (keyboard, screen, console, file, pipe, printer, ...) these streams are associated with, if any, is up to the platform and C implementation you are running the program on. If you want to do such platform specific things as "attachconsole" then you should look at the programming documentation for that platform. Since you appear to be on Windows, I'd suggest looking in MSDN, or asking a Windows Programming forum. Someone knowledgeable about these things (not me, sorry) might answer later in this thread, too.

As to your question "How can I getch/getchar() with a DLL to pause or start output", I am afraid I don't fully understand this either. getch is not a standard C function. As for getchar(), it reads one character from standard input (stdin). I don't understand how this associates with pausing or starting output. Perhaps you're looking to wait for a key press? As I may've said above, C has no notion of a keyboard, but there are platform specific solutions. See The C FAQ for further info.

Finally, you asked "a good site I can go to for information about C functions.", which is the closest thing I could find to a C question. There's a sticky thread in this C programming forum that includes some reference links (see the second post). However, I don't recommend any of them in particular, they tend to be full of errors, though there are exceptions. Here is what I recommend for you to learn C (including function references).

Books:
The C Programming Language by Kernighan and Ritchie. It is old, and doesn't cover the current C standard (C99), but is still an excellent text for both learning C and as a reference, and the C99 specific material can be covered with other references.

C - A Reference Manual by Harbison and Steele. This one does cover C99, and is an excellent reference text.

Online:
ISO/IEC 9899:1999 + TC1 + TC2 + TC3 draft standard document from WG14, the standard working group for the C programming language. This is written in a very formal tone, since it designed to be the authoritative source for C implementors. However, it does contain detailed descriptions of every C function, as you'd expect. This is a freely available draft which is basically the non-free C standard with later technical corrigenda (error corrections, mostly) applied to it. The official standard can be purchased, but is not really necessary for the casual reader since the above draft is freely available.

Last but certainly not least, whichever implementation (compiler + standard library) you are using should provide a good reference for every C function available. It might also point out implementation defined (platform specific) details that might be relevant to you.

Hope this helps.

commented: Nice posting :) +17
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.