Hi all,
I've found two libs to work with Regular Expression in Ansi C:
[Lightweight C++]
http://students.ceid.upatras.gr/~sxanth/lwc/
This is not really a Regexp lib but I can use it to write my expressions on it and then execute the preprocessor to get the generated C code.
[Real Regex Lib]
http://www.osix.net/modules/article/?id=349...
Following the "what's the best use for C" question.
The Linux kernel seems to be a famous and very well thought of C program. But is it a good example of mainstream "best-practice" C?
...
When writing ruby code, it is easy to test how different functions behave by testing them out in irb. But to test code in C, I usually have to open up a separate IDE and write code there to test how it works. Is there an interpreter-like tool available in Unix or Windows platform?
...
Calling all C macro gurus...
Is there any way to write a C macro that will replace something like this:
my_var = 5;
with this:
setVar(&my_var, 5);
In other words, can I write a C macro that will override assignments for a specific variable (in the above example, my_var) and instead pass it to a function whose job it is to set that...
For those of you with experience with both, what are the major differences? For a newcomer to either, which would be better to learn? Are there situations where you might choose C but then other situations where you would choose C++? Is it a case of use the best tool for the job or one is significantly better than the other. I know C+...
I have a pretty good grasp on how a "traditional" .dll works, the differences between dynamic and static loading, etc.
However, I'm confused about how COM objects work:
it is mandatory to register it (with regsvr32)?
can I have two versions of a registered COM object lying in the same/different directory?
besides beying packaged insid...
I'm using winsock and calling connect on a non-blocking socket. I occasionally see some delay (up to 200ms) before the function returns when the CPU is hogged by other processes. From what I know, a connect on a non-blocking socket should return immediately, but perhaps connect causes a context switch and since the CPU is working hard it...
I am having a service which would be running at SYSTEM level. Now, i want to track the logged on user in it. Earlier i was trying to get the logged in user name from GetUserName api but in my case it returns "SYSTEM" every time.
Is there anyway to get logged on username in my case? or is there any hook that i can install so that i may ...
I have looked at http://stackoverflow.com/questions/141525/absolute-beginners-guide-to-bit-shifting but I still find the concept of bit shifting difficult to understand.
Can someone point me in the direction of a more basic guide to bit shifting in C. I expect it will be something really long since it will need to cover the whole subjec...
Is there any way to know whether a MFC message loop is already running?
EDIT: Context: A library (with event handling) needs to know whether its event filtering has to attach to an existing MFC message loop or create its own message loop: in case a main message loop already exists it must not create its own loop because it would be bloc...
How do I initialize a GtkScrolledWindow to avoid scrollbars by growing as much as possible?
By default it seems to be as small as possible.
Demo code (Quit with SIGINT):
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
GtkWidget* window;
GtkWidget* content;
GtkWidget* sw;
gtk_init(&argc, &argv);
window = g...
I need to dump the certain things into a text file and same has needs to be displayed on screen. (I'm telling about a C program utiltiy)
The menu option looks like following,
1. display AA parameters
2. display BB parameters
3. display CC parameters
4. dump all
5. Exit
Select option >
If they select 1/2/3, it just needs to displayed ...
I have a PDF file where every page is a (LZW) TIFF file. I know this because I created it. I want to be able to load it and save it as a bunch of TIFF files.
I can open the PDF file with CGPDFDocumentCreateWithURL, and get a page. I can even draw the page onto the screen.
What I WANT to do is draw the page into a bitmapContext, so that...
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
int main(int argc, char* argv[]){
cvNamedWindow("Window1", CV_WINDOW_AUTOSIZE);
IplImage* image = 0;
->->image = cvLoadImage(argv[1]);<-<-
if(!image) printf("Unable to load image!");
cvShowImage("Window1", image);
char c = cvWaitKey(0);
cvReleaseImage(&...
I read somewhere that snprintf is faster than ostringstream. Has anyone has any experiences with it? If yes why is it faster.
...
Is there a C/C++ library, and documentation about how to collect system and process information on Solaris?
Although I could parse command-line tools, I'd rather use a library that makes the task easier to do.
Thanks
Edit: It has been suggested to use the /proc virtual directory to collect information, however its not much better than...
I'm currently working through the excercises in 'The C Programming Language'. Here's one of my solutions:
int c;
while ((c=getchar()) != EOF) {
if (c == ' ') {
while ((c = getchar()) == ' ')
{} // do nothing?
putchar(' ');
}
putchar(c);
}
I found some solutions here that are quite different to mine and use an ext...
I come from a PHP based background and my new years resolution was to listen to Joel and learn C.
I am using a Windows based PC and I don't mind programming that's focused a little on the Windows side though I will be starting with console applications.
What compiler could I use and why?
What IDE could I use and why?
What other tools...
I have a legacy C code that selects a row using multiple add_field method calls part of DB2 C API. I really do not know how this method is implemented. But by looking at the code, I can see that all columns are bound to their variable counterparts using this method. Sample call looks like this:
add_field("acct_num", SQL_VARCHAR, account...
I would like to programatically change the data associated with a dataset in an HDF5 file. I can't seem to find a way to either delete a dataset by name (allowing me to add it again with the modified data) or update a dataset by name. I'm using the C API for HDF5 1.6.x but pointers towards any HDF5 API would be useful.
...