It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I am reading the C programing guide and all of a sudden it starts talking about pipes. Can someone simply tell me what a pipe is.
They are OS objects appearing as file descriptors in different processes, allowing output of one to be the input of the other. Read here.
You want to read Beej's IPC Guide, specifically the pipe section.
There is no form of IPC that is simpler than pipes. Implemented on every flavor of Unix, pipe() and fork() make up the functionality behind the "|" in "ls | more". They are marginally useful for cool things, but are a good way to learn about basic methods of IPC.
Also check the other guides at http://beej.us/guide/.
Most likely, this means a Pipeline as in the context of Unix-like operating systems, see Pipeline (Unix) in Wikpedia. It is a chain of processes with the output of one process being the input to the next one.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Is it possible to use /proc within a C programm to provide information about the internal state?
For example I contribute the handle internalInfo that a cat /proc/2382/internalInfo outputs me information I would otherwise have to retrieve by e.g. sending a signal to the process to generate the information into the logfile and then parse the logfile etc.
The purpose of procfs : "providing a more convenient and standardized method for dynamically accessing process data held in the kernel" (http://en.wikipedia.org/wiki/Procfs).
In this sense, procfs is to expose the kernel's information about a process, it is not to be used as interprocess communication in user space.
To specifically answer the question: yes, you could expose information about your process to processes using procfs -- this should only be done if the information that is needed is kept within the kernel. procfs should not be used if the information you are trying to access is maintained by the process itself in userspace -- I recommend using some other kind of communication method such as pipes, shared memory, files, or signals.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am very new to programming and I need to write a program that takes an assembly-language program and produces the corresponding machine language.
I need to write the program in C
Does anyone know any good tutorials I can find to create this program?
What you would want to do is finding a datasheet which describes the different op codes for the assembly instructions you're writing. Try ISA "your processor name" - this might come up with something useful.
It probably will be hard and you will run into a lot of problems, but you'll probably learn something from it.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a project I'm going to be doing on a microcontroller. I plan on having it interface with my computer over a USB serial connection. I tried doing the basic tests like putc(getc()), but I'm having trouble getting it to behave as I expect.
With that simple hardware-echo thing, many things just don't work. When I push enter, I just get a carriage return. Backspace does nothing. CTRL-C for breaking doesn't work either.
I'm using GNU Screen as my terminal emulator. How do I learn how to handle all of this(along with stty settings) so I can make a useful command interface on my microcontroller?
You will need to know what terminal type your Screen terminal is emulating so that you know what codes to send out the serial port. For example, if you set your terminal to VT100, you can check out this link which provides some VT100 codes
And for gnu-screen you might want to check this out as it contains an exhaustive list of ESC and control strings/commands that you can use.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have begun writing (in C) a small client/server application which relies on TCP. I lack any experience in network programming. I'm sorry for the open-ended character of this post.
I'm wondering how best to encode and decode messages. I've chosen the following approach:
The client sends commands to the server. Every command has a number assigned to it and a struct. The struct stores the command's arguments and the way the arguments are laid out in memory (and in the stream as well). When the client wants to send a command, it fills the respective struct with data. In order for the server to recognize the command, the client sends one byte which contains the command number. Right after the command number byte, the message itself is fed to the stream (with its fields properly converted to network byte order).
This approach led to working code, but it entails a lot of redundancy (I find myself writing switch statements over and over). Is there a better way? What's the standard procedure?
Google's Protocol Buffers are a nice way to serialize/deserialize data. There are implementations for C.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I would consider myself a fairly competent programmer with experience in Java and VB.net. My latest swim around the programming lake is having me modify a program written in C. (The program is Wireshark, an open source network analyzing tool.) I followed the instructions here http://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html and simply don't know where to go from there. I'd like to use Visual Studio 2008 to work with the code if possible, but will do whatever is necessary. (I'm a total noob at using command prompt to do anything though.)
If you followed those steps, then you've built it. I'll copy Section 2.2.10 here.
2.2.10. Build Wireshark
Now it's time to build Wireshark ...
If you've closed cmd.exe in the meantime, prepare cmd.exe again
nmake -f Makefile.nmake all to build Wireshark
wait for Wireshark to compile - this may take a while!
run C:\wireshark\wireshark-gtk2\wireshark.exe and check if it starts
Just make changes in the code, do these steps over again, and presto! you've modified the program. You may want to bone up on C debuggers if you're doing anything very complicated.