c

How to auto login ssh server and run some command to modify a file.

Here is the limitations: No public key file uploaded to server (since this may be run at different target machine), this is just for an automatic testing program, so security is not a concern. It's automatically program run background, so no user input. I do not want to use "expect" which require user to install. I have know the root u...

best c audio library linux

I was wondering if anyone had an opinion on what they think is the best linux audio library for c. I'm just learning and was experimenting with audio output on libao. edit: right now all I'm trying to do is put out frequency tones. ...

Write a custom PCIe hotplug Linux 2.6.x driver

I'm writing a PCIe driver/module for a custom device. Since the device is hot pluggable, it can disappear at any time. Here how I setup up the pci_driver structure: struct pci_driver my_pci_driver = { .name = "my_pci_driver", .id_table = ids, .probe = "my_pci_driver_probe", .remove = "my_pci_driver_remove" }; But I don't know...

What does void mean in C, C++, and C#?

Looking to get the fundamentals on where the term VOID comes from and why it would be called void. The intention of the question is to assist someone who has no C experience and is suddenly looking at a C-based codebase. ...

File write in C confusion

Hi I am appending at the bottom of the text file this works on windows but on linux instead of appending to the bottom it appends to the top of the text file. The code i am using is. The code must only use C FILE *fout; fout = fopen("dat.txt","a"); fprintf(fout,"&& "); fclose(fout); Please help. Thank you ...

Write simultaneousely to two streams

Is there a way to to couple two streams (or file descriptors) together so that writing to one stream will also write to the second one? (C, Linux) Thanks. ...

What programming skills I need to become an iPhone developer?

I have almost 3 years of programming experience in windows world. I know C and C++ (part of my college education) and have been working on Delphi and C# professionally. I am thinking about learning some iPhone development stuff. What programming/software skills I need to dive in? ...

How to use DSP to speed-up a code on OMAP?

I'm working on a video codec for OMAP3430. I already have code written in C++, and I try to modify/port certain parts of it to take advantage of the DSP (the SDK (OMAP ZOOM3430 SDK) I have has an additional DSP). I tried to port a small for loop which is running over a very small amount of data (~250 bytes), but about 2M times on diffe...

Unpacking an executable from within a library in C/C++

I am developing a library that uses one or more helper executable in the course of doing business. My current implementation requires that the user have the helper executable installed on the system in a known location. For the library to function properly the helper app must be in the correct location and be the correct version. I wo...

Bitfield manipulation in C

The classic problem of testing and setting individual bits in an integer in C is perhaps one the most common intermediate-level programming skills. You set and test with simple bitmasks such as unsigned int mask = 1<<11; if (value & mask) {....} // Test for the bit value |= mask; // set the bit value &= ~mask; // clear the bit ...

BSD Socket issue: inet_ntop returning "0.0.0.0"

I'm trying to get the IP of the machine a socket I've bound is listening on. The port number printed works fine, but the address is "0.0.0.0". Here's the relevant code. res has been passed to getaddrinfo and getsockname before getting to this code. char ip[INET_ADDRSTRLEN]; struct sockaddr_in *ipv4 = (struct sockaddr_in *)res->ai_addr; ...

how to do lua table operations from C?

I need to perform operations on Lua tables from C where the tables are treated as lists or queues. Specifically I need to insert an element at the head, and remove the head element, and have the other elements move to accommodate the new element. This would be simple in straight lua, i'd use table.insert and table.remove. But in C? The...

How do I share variables between different .c files?

beginner question about C declaration: In a .c file, how to use variables defined in another .c file? ...

How to set TCP_NODELAY on BSD socket on Solaris?

I am trying to turn off Nagle's algorithm for a BSD socket using: setsockopt(newSock, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof flag); but the compiler claims TCP_NODELAY hasn't been seen before: error: `TCP_NODELAY' undeclared (first use this function) This is the full list of includes for the file this is in: #include <arpa...

Tab Completion feature in unix shell development

hi to all i am developing a shell using unix system programming (robbins and robbins) how can i add this feature and also how can i add history feature too (history feature like in BASH- when i press up key it shows the previous typed command ) ...

Is there any reason to use the 'auto' keyword in C / C++?

For the longest time I thought there was no reason to use the static keyword in C, because variables declared outside of block-scope were implicitly global. Then I discovered that declaring a variable as static within block-scope would give it permanent duration, and declaring it outside of block-scope (in program-scope) would give it fi...

In C, how do I restrict the scope of a global variable to the file in which it's declared?

I'm new to C. I have a book in front of me that explains C's "file scope", including sample code. But the code only declares and initializes a file scoped variable - it doesn't verify the variable's scope by, say, trying to access it in an illegal way. So! In the spirit of science, I constructed an experiment. File bar.c: static char f...

Is a struct of pointers guaranteed to be represented without padding bits?

I have a linked list, which stores groups of settings for my application: typedef struct settings { struct settings* next; char* name; char* title; char* desc; char* bkfolder; char* srclist; char* arcall; char* incfold; } settings_row; settings_row* first_profile = { 0 }; #define SETTINGS_PER_ROW 7 When I load values ...

POSIX Process Groups

Hi, I'm currently implementing process groups into my operating system project's POSIX subsystem. However, I've become a little confused at the POSIX specification (setsid) (along by Wikipedia's page on Process groups). Our terminal layer sends SIGINT to the foreground process (group, whose id should equal the group leader's PID). In t...

(-1 >> 1) == -1 - Why?

Why does (-1 >> 1) result in -1? I'm working in C, though I don't think that should matter. I can not figure out what I'm missing... Here is an example of a C program that does the calc: #include <stdio.h> int main() { int num1 = -1; int num2 = (num1 >> 1); printf( "num1=%d", num1 ); printf( "\nnum2=%d", num2 ); ...