c

gdb: No symbol "i" in current context.

While debugging a C program in gdb I have a breakpoint in a for loop. I cannot print the value of "i" ( I get : No symbol "i" in current context.). I can print the value of all the other variables. Is it normal? Here is the loop: for (i=0; i < datasize; i++){ if ( feature_mask[i] > 0 ){ k = feature_mask[i] - 1; ...

function pointers error C2373: redefinition; different type modifiers

Hi there, I'm trying to compile some function pointers assignment code. I tried different variations of pointer assignments and __cdecl as well. But without success, after a while I gave up... maybe you'll see something what i can not. I compile with visual express 2008, with flags: /Gd __cdecl calling convention /O2 maximiz...

Microsoft interview Question: Find the errors in this function

I was asked this question in the MS written walkin-interview: Find errors in the program below which is supposed to to return a new string with \n appended to it. char* AddnewlinetoString(char *s) { char buffer[1024]; strcpy(buffer,s); buffer[strlen(s)-1] = '\n'; return buffer; } Thank you all. I'd tried to code on myself a...

Open a locked file in exlusive mode

There is a file which is locked by another process for editing. Is there any way to open the file in exclusive mode using the C program? ...

Know the address of a variable in Visual Studio

Hi, I am starting to learn to debug C programs with Visual Studio 2008. When running in debug mode, how is it possible to know the address of a initialized variable? I choose to watch it but can only know about the value. Thanks ...

Having issues with some homework, C programming stuff.

So the problem is to add 3 numbers together(2's complement) in C. Normally should be very simple, but the hard part of this problem is that you can only use the ops ! ~ & ^ | << >>, no kind of loops, or function calls, or anything fancy. Just those ops. He gives us a function that adds 2 words together. The return of the function I'm...

When a function is called in C, should the variables be given a new address?

Hi, I am a bit confused about the behaviour of a C program from another programmer I am working now with. What I can not understand is the following: 1) a variable is defined this way typedef float (array3d_i)[3]; array3d_i d_i[NMAX]; 2) once some values are assgined to all the d_i's, a function is called which is like this: void c...

How do I receive a signal sent with sigqueue in a c program (on linux)?

Possible Duplicate: How do I receive a signal sent with sigqueue in a c program (on linux)? Hi How do I receive receive a signal sent with sigqueue in a c program (on linux)? If just use kill to send a signal I just add a receiver with something like this signal(SIGUSR1, sigusr1); that point to a simple function like t...

How do I receive a signal sent with sigqueue in a c program (on linux)?

Hi How do I receive receive a signal sent with sigqueue in a c program (on linux)? If just use kill to send a signal I just add a receiver with something like this signal(SIGUSR1, sigusr1); that point to a simple function like this: void sigusr1() { signal(SIGUSR1,sigusr1); printf("SIGUSR1 ....\n"); } But if I send ...

Image tracker libary

Dear everyone, I'm looking for a library either in C C++ or Java that can track an image. With that I mean I want my program to get the web-cam input recognize an image in front of the web-cam and display for example a movie over the web-cam image. Thank you. I just did some more googling and found that what I want to do is called: ...

SQLite string management in transaction mode

I'm using sqlite3_bind_text to bind text parameters to my queries, with the SQLITE_STATIC flag, since I know the text pointer remains valid at least up until the query is executed. Recently I've made changes so that the queries are executed in the transaction mode (many such queries in a single transaction). Should the text buffer remai...

X11: How to make the application to be on top

Hello, Situation I'm using matchbox keyboard which is X11 based application. When any application is in full screen mode matchbox keyboard cannot be visible as the full screened application is on TOP. So is there a way to launch X11 based application over full screened applictions ? Regards, Levon ...

C shared memory

I am trying to implement shared memory on embedded device with uClinux. My C source #include <stdio.h> #include <sys/shm.h> #include <sys/stat.h> #include <sys/socket.h> #include <errno.h> //using namespace std; int main() { int segment_id; segment_id = shmget(04, getpagesize(), IPC_CREAT | 0666); printf("Page...

Creating .I file in C

Sir pls tell me how to create .I file (extended source file) in c ...

How do I set the command line arguments in a C program so that it's visible when users type "ps aux" ?

When you type "ps aux" the ps command shows command arguments that the program was run with. Some programs change this as a way of indicating status. I've tried changing argv[] fields and it doesn't seem to work. Is there a standard way to set the command line arguments so that they appear when the user types ps? That is, this doesn't w...

Linking problem with FreeMagic & GraphicsMagic

Whenever I link in either FreeMagic & GraphicsMagic, i get a SIGABRT as soon as main starts, possibly even before. Any ideas? It is not sufficient to just add the link flags, but for instance adding the call to FreeImage_Initialise(FALSE); somewhere in main() makes the program die in a SIGABRT. Stacktrace from where it crashes: #0 0...

Tool for source code analysis?

Source code analysis and exploration tools for C and C++ seem to be sorely lacking. Are there any tools which I can use to gather information about C and/or C++ source files? cscope does part of what I would need, Doxygen looks closer. At a minimum list of all function, callers, callees, variable references etc. Perhaps Doxygen's xml ...

Is it possible to get the size of a variable in Visual Studio?

While debugging a C program in Visual Studio 2008, is it possible somehow to get the size of variables (in bytes)? P.D. Of course I can print sizeof(var) for each of them ...

How to convert string to base64 ASCII Embedded in c

Possible Duplicate: How do I base64 encode (decode) in C? I am trying to convert an int into an ASCII byte array and then encode the byte array as a base64 string. I see a few posts on how to do this in C# and Java, but I want to do this in C. I'm doing this in windows, using MS Visual Studio. Is there a function provide...

What is the simplest way to write 4 arrays into a file in a multiplatform way?

Say we have a struct of an int array, a float array etc. and we need to write them into a binary format file for fast reloading. Can this be done in a simple way? Should the files be several for each of the array? ...