c

Determining string uniqueness in a large file

In C, I want to process a file that contains 108 16-digit alphanumeric strings and determine if each one is unique in the file. How can I do that? ...

Which eclipse should I get to work with Java, C, Bash and Perl?

I'm using eclipse to work on a project with portions written in Java, C, Perl, and bash. Which version of eclipse should I get for this? I'm currently using 3.5-CDT+perl-plugin and would really like better Java handling with out loosing the C. What plugin should i add for java? How does Eclipse handle multi-language projects? when I hi...

Why is C slow with function calls ?

Hi, I am new here so apologies if I did the post in a wrong way. I was wondering if someone could please explain why is C so slow with function calling ? Its easy to give a shallow answer to the standard question about Recursive Fibonacci, but I would appreciate if I knew the "deeper" reason as deep as possible. Thanks. Edit1 : Sorr...

C please help explain little code

Please help me understand 2 things I found in this C code: First, there is the whole code: usbMsgLen_t usbFunctionSetup(uchar data[8]) { usbRequest_t *rq = (void *)data; static uchar dataBuffer[4]; /* buffer must stay valid when usbFunctionSetup returns */ if(rq->bRequest == CUSTOM_RQ_ECHO){ /* echo -- used for reliabi...

How do I use two 32-bit integers as a 64-bit in C?

I am using a library that returns a structure with a time stamp that is represented by two (TimestampHi, TimestampLo) unsigned longs. I pretty much only need the timestamp printed out as %llu in printf. What's the easiest way to get the data from these two ints and correctly use it as a uint64_t? ...

String Stream in C

print2fp(const void *buffer, size_t size, FILE *stream) { if(fwrite(buffer, 1, size, stream) != size) return -1; return 0; } How to write the data into string stream instead of File stream? ...

Nokogiri Compilation Error - Can't find libraries/headers

Trying to install a gem, but it can't find the headers, despite specifying them: sudo gem install nokogiri -- --with-xml2-lib=/usr/local/lib --with-xml2-include=/usr/local/include/libxml2 --with-xml2-include=/usr/local/include/libxml2 --with-xslt-include=/usr/local/include/libxslt Building native extensions. This could take a while.....

Exposing C function from custom Objective-C Framework

I'm attempting to write my first custom Cocoa Framework and I want to expose a simple C function from the framework that wraps up a bunch of functionality, much like NSApplicationMain does. When I simply imported the files directly from within the project, everything went fine, the project built and my C function was called correctly. N...

Can't use __objc_msg_forward on x86_64

No matter what I do I can't get __objc_msg_forward to work on x86_64 on Linux. If I compile with -m32 it works fine. I put together this simple program to demonstrate. It should print Crasho Barfo twice. #import <objc/Object.h> #import <objc/objc-api.h> #include <stdio.h> #include <stdarg.h> #include <stdlib.h> @interface Object (Test...

IDE(s) for Polyglot programming

I'm working in Java, C ,Perl, and Bash (and a little python) on a project that all work together (mostly via RESTfull interfaces) and am looking for an IDE suited to Polyglot programming? What IDE can i use that has: jump to definition call hierarchy syntax highlighting across at least these languages: Java C Perl all from ...

How to convert cstring to NSString and NSString to cstring?

Lets say i have the following cstring char array[1000]; How i can convert it to NSString and vice verse. Thanks. ...

Sharing variables across files in C

I have two files: hudwidgets.c #include "osd.h" #include "osdadd.h" #include <stdio.h> struct TextSize tsize; char buff[50]; void hud_draw_lin_compass(int cx, int cy, int tick_maj, int tick_min, int range, int heading) { .. important code that uses buff .. } hud.c #include "hudwidgets.h" #include "hud.h" #include "osd.h" #incl...

__decorated__ for python decorators

As of 2.4 (2.6 for classes), python allows you to decorate a function with another function: def d(func): return func @d def test(first): pass It's a convenient syntactic sugar. You can do all sorts of neat stuff with decorators without making a mess. However, if you want to find out the original function that got decorated you hav...

Why won't int variable come before char array in terms of addressing no matter how I code it in C?

I'm reading Hacking: The Art of Exploitation (2nd Edition), and I'm currently on the section about buffer overflows. In the first example, the variables are declared/initialized in this order: int auth_flag = 0; char password_buffer[16]; The example goes on to explain that you can use gdb to examine auth_flag and password_buffer's ad...

how to read intermediate results of the exec command parallely while execution of exec command is going on in C?

I have to execute any other program from my C program which is continuouslly giving messages (intermediate result) on stdout.These messages(intermediate result) i can retrieve after exec finishes its execution(other program is terminated) but my problem is that if execution of exec command is going on ,then how to retrieve these messag...

Explain the output of this C code?

I wrote this code today, just out of experimentation, and I'm trying to figure out the output. /* * This code in C attempts to exploit insufficient bounds checking * to legitimate advantage. * * A dynamic structure with the accessibility of an array. * Handy for small-time code, but largely unreliable. */ int array[1] = {...

How to input into an array.

main(int c,char **args){ int i char input[100]; bzero(input,100); for(i=1;i<c;i++) { input=strcat(input,args); input=strcat(input," "); } } i have included the string.h header file.... I want the input i enter in the command line to be stored in the input array. could anyone please correct my code.. Thank you. ...

what are your opinion about this algoritm?

////////////////comet snake//////////////////////////////////// //////////////////////////////////////////////////////// //Compilator :Microsoft Visual C++ // //Created by :Dani (Indonesia) //My Email :[email protected] //My Graduate is Architech // /////This is still practice program for me///////// /////so, many bugs are m...

What's the principle of blocking mode?

Like blocks until the file is done playing, what's the principle and how to implement this? ...

Bitshift and integer promotion?

Normally, C requires that a binary operator's operands are promoted to the type of the higher-ranking operand. This can be exploited to avoid filling code with verbose casts, for example: if (x-48U<10) ... y = x+0ULL << 40; etc. However, I've found that, at least with gcc, this behavior does not work for bitshifts. I.e. int x = 1; u...