c

How set opacity to GtkWindow inside GtkEventBox.

I want to set opacity of GtkWindow inside GtkEventBox. gtk_event_box_set_visible_window(GTK_EVENT_BOX(eventbox), TRUE); gtk_window_set_opacity(event_top->window, 1); I am getting Following Error: enter code here`Gtk-CRITICAL **: gtk_window_set_opacity: assertion `GTK_IS_WINDOW (window)'failed Am i doing it write way? Thanks, P...

What does it mean "regular file" according to S_ISREG C/C++ ?

Hello all, Let's consider the following 3 code lines: struct stat buffer; status = lstat(file.c_str(), &buffer); bool Flag = S_ISREG(buffer.st_mode) When S_ISREG() returns true it tells you that the file is a regular file What does regular means exactly ? Thanks ...

C++: parsing with simple regular expression or shoud I use sscanf?

I need to parse a string like func1(arg1, arg2); func2(arg3, arg4);. It's not a very complex parsing problem, so I would prefer to avoid resorting to flex/bison or similar utilities. My first approch was to try to use POSIX C regcomp/regexec or Boost implementation of C++ std::regex. I wrote the following regular expression, which does ...

Ignoring characters in a file while parsing

i need to parse through a text file and process the data. the valid data is usually denoted by either a timestamp with TS followed by 10 numbers (TS1040501134) or values with a alpabet followed by nine numbers (A098098098)...so it will be like TS1040501134A111111111B222222222...........TS1020304050A000000000........ However, there are c...

System call Vs Function call

What is the difference between system call and function call. Is fopen a system call or function call. ...

More GCC link time issues: undefined reference to main

Hi Guys, I'm writing software for a Cortex-A8 processor and I have to write some ARM assembly code to access specific registers. I'm making use of the gnu compilers and related tool chains, these tools are installed on the processor board(Freescale i.MX515) with Ubuntu. I make a connection to it from my host PC(Windows) using WinS...

Strlen of MAX 16 chars string using bitwise operators

The challenge is to find the fastest way to determine in C/C++ the length of a c-string using bitwise operations in C. char thestring[16]; The c-string has a max size of 16 chars and is inside a buffer If the string is equal to 16 chars doesn't have the null byte at the end. I am sure can be done but didn't got it right yet. I am wo...

error in strcmp() function in c

Suppose I have a character array d[20] which has d[0]='i' and d[1]='f' and I assign null value d[2]='\0': What is value of strcmp(d,"if") and why? I expect strcmp to return a value of 0. when i run it i get a value of -1 and not 0 .. ...

New to C/C++ Using Android NDK to port Legacy code, getting compile errors

I have been trying to take some old Symbian C++ code over to Android today using the NDK. I have little to no C or C++ knowledge so its been a chore, however has to be done. My main issue is that I'm having trouble porting what I believe is Symbian specifi code to work using the small C/C++ subset that is available with the Android NDK...

error in coding a lexer in c

#include<stdio.h> #include<ctype.h> #include<string.h> /* this is a lexer which recognizes constants , variables ,symbols, identifiers , functions , comments and also header files . It stores the lexemes in 3 different files . One file contains all the headers and the comments . Another file will contain all the variables , another will...

node is giving garbage value....

hi, i am doing c program of binary tree while inserting the node to tree after 2 or 3 nodes the child node having garbage value and crashing i am doing in xcode any idea... Bnode createTreeNode() { Bnode node=(Bnode)malloc(sizeof(Bnode)); return node; } Bnode addTreeNode(Bnode inNode, char *inData) { int compareValue; ...

Calling R Script from within C-Code

Hi, Is there a way to call an R-Script within C-Code? I did find the R Api for C (chaper 6. of the 'Writing R Extensions' manual), but as far as I understood this does "only" allow to call the C-Implementation of R. Of cause I could call the R-Script via shell, but that's no solution for me, since this does not allow proper passing of...

Why does my Perl TCP server script hang with many TCP connections?

I've got a strange issue with a server accepting TCP connections. Even though there are normally some processes waiting, at some volume of connections it hangs. Long version: The server is written in Perl and binds a $srv socket with the reuse flag and listen == 5. Afterwards, it forks into 10 processes with a loop of $clt=$srv->accept...

Does Objective-C 2.0 garbage collection collect C structures?

What exactly does the Objective-C garbage collector collect? For example, if I'm writing a program in Objective-C 2.0, and I use some plain C structs, does my code need to worry about manually freeing that memory? ...

Default input and output buffering for fopen'd files?

So a FILE stream can have both input and output buffers. You can adjust the output stream using setvbuf (I am unaware of any method to play with the input buffer size and behavior). Also, by default the buffer is BUFSIZ (not sure if this is a POSIX or C thing). It is very clear what this means for stdin/stdout/stderr, but what are the d...

How does this "hello world!" program work?

int main(void) { return('yes', *"no", **main, *********printf) ("hello world!\n") *0; } outputs hello world!, but how does it actually work? ...

Control flow graph & cyclometric complexity for folowing procedure

insertion_procedure (int a[], int p [], int N) { int i,j,k; for (i=0; i<=N; i++) p[i] = i; for (i=2; i<=N; i++) { k = p[i]; j = 1; while (a[p[j-1]] > a[k]) {p[j] = p[j-1]; j--} p[j] = k; } } I have to find cyclometric complexity for this code and then suggest some white box test cases...

Why are Hexadecimal Prefixed as 0x?

Why are Hexadecimal Prefixed as 0x and not anything else? I understand the usage of prefix but I dont understand the significance of 0x. ...

inline function in c

Can inline function be declared in .h and defined once in .c? ...

How to get address of va_arg?

I hack some old C API and i got a compile error with the following code: void OP_Exec( OP* op , ... ) { int i; va_list vl; va_start(vl,op); for( i = 0; i < op->param_count; ++i ) { switch( op->param_type[i] ) { case OP_PCHAR: op->param_buffer[i] = va_arg(vl,char*); // ok i...