Hi,
I want an simple IDE/editor for C in Linux to which I can add features easily. For example: I want to add a right click menu item and a related action for the editor. It should be easy to extent and add any desirable functionality. I tried eclipse CDT but its to much of learning(I mean knowing the eclipse plug-in architecture and th...
I need a way to get the elapsed time (wall-clock time) since a program started, in a way that is resilient to users meddling with the system clock.
On windows, the non standard clock() implementation doesn't do the trick, as it appears to work just by calculating the difference with the time sampled at start up, so that I get negative v...
Hi,
i want to sprintf() an unsigned long long value in visual C++ 6.0 (plain C).
char buf[1000]; //bad coding
unsigned __int64 l = 12345678;
char t1[6] = "test1";
char t2[6] = "test2";
sprintf(buf, "%lli, %s, %s", l, t1, t2);
gives the result
12345678, (null), test1
(watch that test2 is not printed)
and l = 123456789012345 it ...
Hi All,
I want to get the full path of the running process (executable) without having root permission using C++ code. Can someone suggest a way to achieve this.
on Linux platforms i can do it by using following way.
char exepath[1024] = {0};
char procid[1024] = {0};
char exelink[1024] = {0};
sprintf(procid, "%u", getpid());
strcpy(e...
I have a large array in C (not C++ if that makes a difference). I want to initialize all members to the same value. I could swear I once knew a simple way to do this. I could use memset() in my case, but isn't there a way to do this that is built right into the C syntax?
...
I am writing some JNI code in C that I wish to test using cunit. In order to call the JNI functions, I need to create a valid JNIEnv struct.
Does anyone know if there is a mocking framework for such a purpose, or who can give me some pointers on how to create a mock JNIEnv struct myself?
...
Just because I'm curious--is there any C analog to the functionality of the STL in C++? I've seen mention of a GTK+ library called glib that a few people consider fills the bill but are there other libraries that would provide STL functionality in C?
...
This was an job placement interview I faced. They asked whether we can realloc Array, I told yes. Then They asked - then why we need pointers as most of the people give reason that it wastes memory space. I could not able to give satisfactory answer. If any body can give any satisfactory answer, I'll be obliged. Please mention any situat...
I am in the process of setting up the wso2 php web services framework on my ubuntu 8.04 development server.
However my webservice is failing. Looking into the wsf_client.log (custom log for the framework) file gives me the error in the question.
I belive the error is returned from axis, but I have no idea how to fix it and would be gra...
How do you get a pointer to the .text section of memory for a program from within that program? I also need the length of the section to do a "Flash to Memory" compare as part of a continuous selftest that runs in the background.
The toolset automatically generates the linker .cmd file for the tools I'm using, and the Board Support Pac...
Hi,
I am working on a robot automation project and I have run into a road block. To control the robot, one needs to connect with it wirelessly via telnet and send commands through the tcp/ip protocol. (ex. The 'Mabc' command moves it forward based on the left wheel speed (a), the right wheel speed (b) and time (c)). What I am trying to ...
I have a C application that I've created in VS2008. I am creating a mock creation function that overrides function references in a struct. However if I try and do this in a straight forward fashion with something like:
void *ptr = &(*env)->GetVersion;
*ptr = <address of new function>
then I get a "error C2100: illegal indirection" err...
How can my app get a list of the True Type Fonts that are available on Linux.
Is there a standard directory where they are stored across different distributions? Or some other standard way to locate them?
...
I've been getting this undefined symbol building with this command line:
$ gcc test.cpp
Undefined symbols:
"___gxx_personality_v0", referenced from:
etc...
test.cpp is simple and should build fine. What is the deal?
...
I have a thread running in the background that is reading events from an input device in a blocking fashion, now when I exit the application I want to clean up the thread properly, but I can't just run a pthread_join() because the thread would never exit due to the blocking IO.
How do I properly solve that situation? Should I send a pth...
Hi,
I have a very simple question. I want to test whether a particular port is currently under use or not. For this, I want to bind a TCP socket to the port, if the connection is refused means the port is in use and if not that mean the port is free.
Can someone please tell me how can I write the TCP socket code in C? I am on a solaris...
What way is the most efficient and why? int main()? void main()? return 1? return 0?
...
I'm required to write documentation for my current project that lists all .c files and for each one lists every .h file which is directly or indirectly included by that file.
This is a large project, and although we have Makefiles which theoretically have this information, those Makefiles are sometimes incorrect (we inherited this proje...
Say I have a C function which takes a variable number of arguments: How can I call another function which expects a variable number of arguments from inside of it, passing all the arguments that got into the first function?
Example:
void format_string(char *fmt, ...);
void debug_print(int dbg_lvl, char *fmt, ...) {
format_string(f...
I had a nasty typo that wasted my time and my colleague's time, it was something like this:
for (i = 0; i < blah; i++); // <- I had a semi-colon here, that's the bug!
{
// Some awesome logic here
}
First of all, it's very embarrassing, second thing, I should never repeat this. I'm relatively new to C. In Java, I guess I can use Find...