c

Man pages for libvlc

Hi! all. Though I am not sure wether this question belongs to here but pardon me if not so. Can you people guide me to the manual page of libvlc functions like(just give a kind of pointer where these functions are described in detail) void libvlc_playlist_pause( libvlc_instance *, libvlc_exception ) mtime_t libvlc_inpu...

How to insert any string in sqlite3 in c

Hi I have to insert a string into a sqlite data base my command .. Err=sqlite_exec(DB, "create table tbl5(TEXT varchar(100));", xCallback, (void*)"First Test", &ErrMsg); Err=sqlite_exec(DB, "insert into tbl5 values ('some string');", xCallback, (void*)"First Test", &ErrMsg); works fine but when I want to put s="some string" ie E...

Sleep thread 100.8564 milisecond in c++ under window plateform

I there any method to sleep the thread upto 100.8564 millisecond under window OS. I am using multimedia timer but its resolution is minimum 1 second. Kindly guide me so that I can handle the fractional part of the milisecond. ...

On linux, how to check if port is in listen state without trying to connect.

Hi, How do I check with C if a port on my local machine (if required by passing an IP or interface, too), is in listen state? I don't want to connect to this port for checking because I don't want to irritate the service behind this port. I want to use this to add the missing net.tcp.listen item to Zabbix. EDIT - THIS IS THE REAL ANS...

Building an http packet in libnet(tcp packet), Please help us as soon as posible. we are stuck!

we are building a NAT program,we change each packet that comes from our internal subnet, change it's source IP address by libnet functions.( catch the packet with libpcap, put it sniff structures and build the new packet with libnet) over TCP, the syn/ack packets are good after the change, and when a HTTP-GET request is coming, we ca...

Sending while receiving in C

I've made a piece of code in what's on my server as multiple threads The problem is that it doesn't send data while im receiving on the other socket. so if i send something from to client 1 to client 2, client2 only receives if he sends something himself(jumps out of the recv function) .. how can i solve this ? /* Thread*/ while (! ...

circular shift c

I have to shift the int one place to the right and return it In Java i can just return n >> 1; Is this possible in C? The method we were given is as follows // Return n after a right circular 1-bit shift unsigned int right_circular_shift_1(unsigned int n) { ...

getting started with libmms

Actually, the title explains it all... I want to read a stream, but have no idea from where to start. I've searched the web for some documentation/tutorial/whatever with no luck. Any help using this lib would be very appreciated. [CLARIFICATION] I am talking about MMS stream protocol library that can be found here. LibMMS is a common l...

how to search "n bits" in a byte array?

i have a byte array. Now i need to know the count of appearances of a bit pattern which length is N. For example, my byte array is "00100100 10010010" and the pattern is "001". here N=3, and the count is 5. Dealing with bits is always my weak side. ...

Generate Random Number from fix Set of numbers in iphone

Suppose I have One set of numbers i.e {1, 6, 3, 5, 7, 9} I want to Generate Random number from this set of number only i.e. a Generated number should be random and should be from these number({1, 6, 3, 5, 7, 9}) only. standard C/C++ function will also do... ...

IAR Embedded Workbench - setting endian-ness of variable

I'm using IAR Embedded Workbench for ARM (ARM7TDMI-S) and the majority of my work is done using little-endian format. However, I saw in the manual that I can do something like : __big_endian int i, j; to declare those two variables as big endian (while the rest of the app as little endian). This seems like a fantastic feature, but w...

const read only local copies

Hello gcc 4.4.4 c89 I am just wondering is it worth passing a const into a function. i.e. void do_something(const char *dest, const int size) The size is a read-only so I don't want to change it. However, some developers never have this as const has it is a local copy that is being used. The pointer is const as you can change the...

Accessing char* after assigning its value C

Hi, I have assign the value of a member variable as under: myValue = (char*)malloc(strlen(inValue) * sizeof(char)); strcpy(mValue, inValue); while assigning it the value was proper as(taking printf output): http://www.w3.org/2001/XMLSchema But, when i get its value after wards i get it as: http://www.w3.org/2001/XMLSchema(! Wh...

What to throw in a C++ class wrapping a C library ?

I have to create a set of wrapping C++ classes around an existing C library. For many objects of the C library, the construction is done by calling something like britney_spears* create_britney_spears() and the opposite function void free_britney_spears(britney_spears* brit). If the allocation of a britney_spears fails, create_britney_...

How to compile a static library using the Android NDK?

I'm trying to compile a static library to use on Android but I can't figure out how to compile it. The library uses standard libraries (stdio.h etc...) and libxml2. I am trying to compile using arm-eabi-gcc but I get the following error: /cygdrive/c/android-ndk-r4/build/platforms/android-8/arch-x86/usr/include/asm/posix_types.h:15:28: ...

Avoid incompatible pointer warning when dealing with double-indirection

Assuming this program: #include <stdio.h> #include <string.h> static void ring_pool_alloc(void **p, size_t n) { static unsigned char pool[256], i = 0; *p = &pool[i]; i += n; } int main(void) { char *str; ring_pool_alloc(&str, 7); strcpy(str, "foobar"); printf("%s\n", str); return 0; } ... is it pos...

Changing default compiler in Linux, using SCons

On my Linux platform, I have several versions of gcc. Under usr/bin I have: gcc34 gcc44 gcc Here are some outputs: $ gcc --version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48) $ gcc44 --version gcc44 (GCC) 4.4.0 20090514 (Red Hat 4.4.0-6) I need to use the 4.4 version of gcc however the default seems to the 4.1 one. I there a wa...

microsoft windows driver kit pure C try catch syntax ?

In the Windows Driver Kit (WDK) there are some driver code samples written in pure C, but sprinkled with some try-catch-finally constructs. Does someone know their semantics ? Thank you microsoft for your great tools and standards compliance. Code extract from some_file.c: try { ... if (!NT_SUCCESS( status )) { leave; /...

Getting lotus note document UNID

Is there any way to get lotus notes UNID using NOTEHANLE? I am working with Lotus Notes C API (8.5). Thanks. ...

Alternative Control Structures

I've been wondering about alternative ways to write control structures like you can write your own language constructs in Forth. One that you learn early on for if statements is a replacement for this: if ( x ) { // true } else { // false } with this (sometimes this is more readable compared to lots of brackets): x ? true : fa...