c

[SOLVED] Trouble spotting memory leak cStringUsingEncoding

Hey, I am trying to convert NSString to a C string using cStringUsingEncoding but I have a memory leak. My understanding is that cStringUsingEncoding returns a pointer to a character array that is only guaranteed to exist for the duration of the NSString object. As such you should copy its contents to another string. Here's where my prob...

When is it practical to use a parser generator?

I'm writing a simple text-template language for a web application I'm writing (think google's ctemplate). When finished, it'll feature only a small number of possible actions, simple stuff like "evaluate and execute", "evaluate and print", "evaluate and escape html", "comment". I was thinking of hand writing the whole parser from scratch...

most efficient way to get current time/date/day in C

What is the most efficient way of getting current time/date/day/year in C language? As I have to execute this many times, I need a real efficient way. I am on freeBSD. thanks in advance. ...

Gtkuimanager popup submenu

Hello, Where can i find example: popup menu with sub-menus made with GtkUiManager. Thank you ...

What is the macro definition of isupper in C?

I want to know how the "isupper" macro is defined in C/C++. Could you please provide me the same or point me to available resources. I tried looking at ctype.h but couldnt figure it out. ...

calling C++ methods from C

So it's been a while since I've used straight C. And I'm on a project where I'm working on an API in C++. Most of these methods are just C anyway, and all of the return values are C structures. Except one. One method I need to return a vector<string>. Now here's my question. Is C++ methods/libraries/whatever callable from C? I ask becaus...

Windows.h and clang (LLVM)

Hi, I'm trying to compile a little project that includes windows.h using the clang compiler. Unfortunately, clang produces some errors I'm not able to resolve. What's causing these errors? Does clang not support all required features, am I missing something? In file included from C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include/w...

Prevent propagation of GSignal to further registered GCallbacks

How to prevent further signal handlers to be called from the first signal handler callback in GSignal? For example, i register three functions - func1, func2 and func3 for the same signal "mysignal". If func1 is called first, how can i prevent func2 and func3 to be called from func1? This should not be made permanent. It should be runt...

Unable to Open Handle

Please see the code: int main(int argc,LPTSTR argv[]) { HANDLE hinFile; BOOL check; PLARGE_INTEGER file_size; hinFile=CreateFile(argv[1],GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); if(hinFile==INVALID_HANDLE_VALUE) {printf("INVALID_HANDLE_VALUE\nFile Does Not Exist");exit(0);} else{ check=GetFileSize...

Redeclaring/extending typedef defined in Objective-C protocol in class conforming to protocol

I have an Objective-C protocol: typedef enum { ViewStateNone } ViewState; @protocol ViewStateable - (void)initViewState:(ViewState)viewState; - (void)setViewState:(ViewState)viewState; @end I'm using this protocol in the following class: #import "ViewStateable.h" typedef enum { ViewStateNone, ViewStateSummary, Vie...

Mechanize/SeleniumRC Alternatives in C/C++

Are there any C/C++ alternatives to Selenium RC or WWW::Mechanize/Python Mechanize? I guess an option would be to embed Firefox, but I just require something that will allow me to automate testing of websites while honoring state. ...

sorting in keil

i am supposed to code a bubble sort program in embedded C using keil uVision. I havnt yt understood what is it that is actually required. I have been told to use registers and/or ports in it. if anyone can understand what exactly has to be done pls help me out... ...

which is the best way to generate choices out of a given set of numbers?

for example if it is given to make all the choices between 1 to 5 and the answer goes like this.. 1,2,3,4,5, 1-2,1-3,1-4,1-5,2-3,2-4,2-5,3-4,3-5,4-5, 1-2-3,1-2-4,1-2-5,1-3-4, ....., 1-2-3-4-5. can anyone suggest a fast algorithm? ...

Library similar to BeautifulSoup and "HTML Agility Pack" but for C or Java?

I am preparing some custom performance tests against a legacy application that outputs nonstandard HTML (missing tags, duplicate quotes, missing quotes, the works) that can't be changed right now for all the usual reasons. I am looking for a library similar to BeautifulSoup or "HTML Agility Pack" that can be called from C or Java on a U...

Why does my program read an extra structure?

Hi all. I'm making a small console-based rpg, to brush up on my programming skills. I am using structures to store character data. Things like their HP, Strength, perhaps Inventory down the road. One of the key things I need to be able to do is load and save characters. Which means reading and saving structures. Right now I'm just savi...

Growl notification C

Is it possible to send a Growl message in a C program? ...

how to learn c basic easily and quickly?

how to learn c basic easily and quickly? ...

c - grouping strings in a struct

I have a bunch of strings that look like: 'Hello1-FOO', 'Aello2-FOO', 'Bye1-BAR', 'Bye3-BAR', 'Hello22-FOO', 'Bye4-BAR', 'Welcome-BAR' ... All of them are stored on a struct. struct str { char *strings; } ... struct str **t_str; size_t j; t_str = malloc(sizeof *t_str * 20); for (j = 0; j < 20; j++) t_str[j] = malloc(sizeof *t...

What is fastest method to calculate a number having only bit set which is the most significant digit set in another number?

Possible Duplicates: Previous power of 2 Getting the Leftmost Bit What I want is, suppose there is a number 5 i.e. 101. My answer should be 100. For 9 i.e. 1001, the answer should be 1000 ...

Start a process in the background in Linux with C

I am trying to do something a little weird here. I need to start a process, logcat, from a deamon that will run in the background and print to the terminal without taking control of stdin. It is for logging so ideally logcat will print log messages while still allowing the user to input standard commands and initialize programs from th...