c

How can I make rdoc properly read method arguments from my c extension?

Hello, all, I'm using rdoc to generate documentation for my Ruby code which contains C-extensions, but I'm having problems with my method arguments. Rdoc doesn't parse their names correctly and instead uses p1, p2 etc. So, first off, my extensions are actually compiled as C++ so I have to use function definitions that look like this: ...

Calling an external program from python

So I have this shell script: echo "Enter text to be classified, hit return to run classification." read text if [ `echo "$text" | sed -r 's/ +/ /g' | bin/stupidfilter data/c_rbf` = "1.000000" ] then echo "Text is not likely to be stupid." fi if [ `echo "$text" | sed -r 's/ +/ /g' | bin/stupidfilter data/c_rbf` = "0.000000" ] then ...

How to Make a PyMe (Python library) Run in Python 2.4 on Windows?

I want to run this library on Python 2.4 in Windows XP. I installed the pygpgme-0.8.1.win32.exe file but got this: >>> from pyme import core Traceback (most recent call last): File "<stdin>", line 1, in ? File "C:\Python24\Lib\site-packages\pyme\core.py", line 22, in ? import pygpgme File "C:\Python24\Lib\site-packages\pyme\p...

How to detect UTF-8 in plain C?

I am looking for a code snippet in plain old C that detects that the given string is in UTF-8 encoding. I know the solution with regex, but for various reasons it would be better to avoid using anything but plain C in this particular case. Solution with regex looks like this (warning: various checks omitted): #define UTF8_DETECT_REGEXP...

Extract integer from char buffer

Hi I have a very simple problem in C. I am reading a file linewise, and store it in a buffer char line[80]; Each line has the following structure: Timings results : 2215543 Timings results : 22155431 Timings results : 221554332 Timings results : 2215543 What I am trying to do, is to extract the integer value from this line. Does ...

Inline float to uint "representation" not working?

This is in C, but I tagged it C++ incase it's the same. This is being built with: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.220 for 80x86 if that makes any different Why does this work? (inVal is 0x80) float flt = (float) inVal; outVal = *((unsigned long*)&flt); (results in outVal being 0x43000000 -- cor...

Compiling/Matching POSIX Regular Expressions in C

I'm trying to match the following items in the string pcode: u followed by a 1 or 2 digit number phaseu phasep x (surrounded by non-word chars) y (surrounded by non-word chars) z (surrounded by non-word chars) I've tried to implement a regex match using the POSIX regex functions (shown below), but have two problems: The compiled pa...

Enumerate all window handles on desktop

Is there a Win32 API way to get an enumeration of all the open windows? Seems like there must be just not sure where to start looking. ...

WinInet POST via SSL (HTTPS) with pure C?

Hi, I'm stuck trying to get a WinInet HTTP POST via SSL using ONLY C. I know it's possible. Any good sample code? Thanks so much! EDIT: the following code seems to be working OK under C++ using WinHTTP but I need WinInet: TCHAR szTemp[512] = {0}; BOOL bRet = FALSE; HINTERNET hRequest = NULL; HINTERNET hSession = NULL; HINTERNET hConn...

x86 inline assembler flag

Hi Silly question, but I just can not find the necessary flag in gcc. Basically, I have in my C program the following inline assembler code asm volatile ("lea ebx, [timings] \n\t"); When compiling, I get an errormessage which says: Error: invalid char '[' beginning operand 2 `[timings]' Now I remember that a long time ago I used some...

Why do you have to link the math library in C?

If I put stdlib.h or stdio.h, I don't have to link those but I have to link when I compile: gcc test.c -o test -lm What is the reason for that? Why do I have to explicitly link the math library but not the other libraries? Any links explaining why would be appreciated. Thanks for the help :) ...

How can I detect hung processes in Linux using C?

Duplicate: Linux API to list running processes? How can I detect hung processes in Linux using C? ...

How does _XPG4_2 and other defines work on Solaris?

On Solaris, in order to get the msg_control field in struct msghdr and have IPV6_TCLASS I seem to need to define _XPG4_2 and __EXTENSIONS__. It seems to work if I just define these to 1 before including anything: #if defined (__SVR4) && defined (__sun) # define _XPG4_2 1 # define __EXTENSIONS__ 1 #endif Should I do it this way? Do I...

Saving JPEG screenshot as a BYTE buffer in C

In one of my previous questions I asked how to take a screenshot and save it as JPEG without the use of GDI+ due to the constrains of having to use only C. At the end I answered the question myself with the help of of some of the comments there. Using a very terse C version of GDI+ (loaded at runtime) i can take a screenshot and save it...

iPhone: Using C Libraries

I'm trying to write an SSH client for the iPhone, and I'd like to use the libssh2 open source library to do so. It's written in C. What is the best way to use this C library for my iPhone app? Should I compile it into some binary that I include into the my app, or do I add all the source to my project and try to compile it along with ...

Adding leading underscores to assembly symbols with GCC on Win32?

I have a piece of C code that calls a function defined in assembly. By way of example, let's say foo.c contains: int bar(int x); /* returns 2x */ int main(int argc, char *argv[]) { return bar(7); } And bar.s contains the implementation of bar() in x86 assembly: .global bar bar: movl 4(%esp), %eax addl %eax, %eax r...

What is the size of the memory area pointed to by an unsigned char *?

Ok, I know this has been asked before but after searching I couldn't find a proper answer. I need to convert a buffer (unsigned char *) to base64, the base64 function I am using takes as paramters: void Base64Enc(const unsigned char *src, int srclen, unsigned char *dest) where int srclen is the length of the src string. My question ...

Is it possible to customize the indent style of XCode?

For example, I'd like to not indent namespaces in C++ code, but the prefpane doesn't seem to have any place to make a decision of this granularity. Is there some hidden config file or something? Or am I just out of luck? ...

Seeking and reading large files in a Linux C++ application

I am running into integer overflow using the standard ftell and fseek options inside of G++, but I guess I was mistaken because it seems that ftell64 and fseek64 are not available. I have been searching and many websites seem to reference using lseek with the off64_t datatype, but I have not found any examples referencing something equal...

C Editor or Compiler for Windows CE

Hello, Someone can please answer to me, if have any Editor or Compiler to C language for Windows CE 3.1( Jornada 720 - HPC 2000 ), because i'm a Visual Basic developer and i have buyed a book of C only for play with this language in my free time, and the time that is free to me i'm using my Jornada 720, but remember that i've want somet...