c

how do I do sscanf in c#

how do I do this in C#? int a,b,c; sscanf(astring,"%d %d %d",&a,&b,&c); minimal code and dependencies is preferable, is there some built in regex stuff? I'm using c# 4.0 ...

regex tutorials or books

Hello, gcc 4.4.4 c89 Does anyone know of any good online tutorials using regex in c. I have to do a lot of regex, which I haven't done before. If the tutorials or books could be related to sscanf would be even better. Many thanks, ...

hybrid algorithms in energy efficiency for wireless lan

Hi friends I looking for hybrid algorithms in energy efficiency for wireless lan. I look an example of this code in c ,cpp, matlab or any other language that I can easily use it. I already write RSA and ECC algoritm ,but I dont have any idea about how to implement hybrid algoritm,would you help me in this problem? RSA = Rivest Shamir ...

A* implemented in C

Where can I find an A* implementation in C? I was looking around but it seems my google-fu is not strong enough. I've started writing my own implementation, but then I remembered Stack Overflow and I thought I should ask here first. It seems a bit complicated to write a real A* implementation - I was tempted to just write an implementat...

file transfer programm between linux machines using serial port -rs 232

/* program for PC1*/ #include<stdio.h> #include<termios.h> #include<fcntl.h> #include<unistd.h> #include<errno.h> #include<string.h> #include<stdlib.h> /************************ port open() *****************************************/ int port_open(void) { int port_fd; port_fd=open("/dev/ttyS0",O_RDWR|O_NONBLOCK|O_NOCTTY); // print...

Physical location aware user space memory allocation in Linux (memory controller affinity)

I want to test the performance variations that may happen if memory is allocated and accessed from different physical CPUs and from different embedded memory controllers for a 64 bit, 2 CPU, 16 core Intel Xeon 5500 CPU based server. (Dell T710) Looking at the vendor white paper i can see each physical CPU has 3 independent memory contro...

How to read from a file except the last line in C?

I am having a file where i need to read the data and store it into a structure. 10001 john 10002 david 10003 randy 10/10/2010 15:50:55 Updated by : Name now for the above file i need to read the data from '10001' & 'john' till '10003' & 'randy' except the last line(End of the file). How to do it in C? Update : last line will be dy...

how to write a c program that runs on a mobile phone?

i wanna write a C program that runs on a mobile phone. Just for learning purpose. i think it's possible. but i dont know where to start with and the libraries that are available for it. i have also planned to write a game that runs on a mobile phone. help me to do it. thanks in advance. ...

Code polisher / reformater for C, C++ or Fortran

Hello, suppose you have got a bunch of files written in C, C++ or Fortran, by different authors with different opinions on formating, how to comment (...) and so on. I think many people know situations like these. Are there any free tools for ends like: uniform format of code (indent etc.) create standard comment bodies rename variab...

Trying to get GetPrimaryMACAddress to stop printing verbose

Okay, this one seems to me a bit weird. Any help would be greatly appreciated. I recently implemented code that I found here to get the MAC address. The funny thing is that is prints to the console (in addition to the MAC address) something like the following: <CFData 0x317df0 [0xa03e9ee0]>{length = 6, capacity = 6, bytes = 0x001f5bd...

How to return an array, without allocating it, if size is unknown to caller?

Consider following function: int get_something (int* array, int size); It's purpose is to fill the passed array[size] with data from external resource (queryes to resource are expensive). The question is what to do, if resource has more elements, than provided array can handle? What is the best approach? Edit: Current solution added:...

Question about a wrapper macro function

I was reading the jemalloc's realloc function and noticed that all the non-static functions(at least the ones I've seen) in jemalloc is wrapped with JEMALLOC_P macro and JEMALLOC_P is: #define JEMALLOC_P(s) s Why would they need such a thing? ...

Problem in process hooking

I have a process (say, for example, MyProcessA), hooked an exe and injected my dll (MyDll.dll) into the process space of MyProcessA, so even if it's gonna create n number of child processes it will be process hooked as well. I have no problem in hooking and injecting the dll into the process. I have hooked all file and process dependant ...

How to stop a process using a "Stop Button"

Hi, I created a simple window with two buttons, the first one calls a function that lasts a long time, the second one sets the value of a variable "stop" to TRUE, that was initially set to FALSE. My intention is that, by pressing the first button it runs a long process, that controls if the stop variable is set to TRUE or FALSE for ever...

Export sqlite3 table to a text file from C program

Iam having a database in Sqlite3. I am doing all my operations by writing application in Linux C(API:sqlite3_exec). Currently Iam trying to export the database to a text file. Can anyone suggest query statements fro the same. ...

How to pass a 2D dynamically allocated array to a function?

Hello, I have a 2 dimensional array dynamically allocated in my C code, in my function main. I need to pass this 2D array to a function. Since the columns and rows of the array are run time variables, i know one way to pass it is : -Pass the rows,column variables and the pointer to that [0][0] element of the array myfunc(&arr[0][0],r...

C Programming - Pass-by-Reference

In the C program below, I don't understand why buf[0] = 'A' after I call foo. Isn't foo doing pass-by-value? #include <stdio.h> #include <stdlib.h> void foo(char buf[]) { buf[0] = 'A'; } int main(int argc, char *argv[]) { char buf[10]; buf[0] = 'B'; printf("before foo | buf[0] = %c\n", buf[...

in X is it possible to detect when shift is pressed and released when it isn't modifying another key?

as in the title, it doesn't appear to generate an event unless another key/button is pressed at the same time. thanks, james ...

clang cannot find MinimalAction

I get an error when trying to use class MinimalAction in clang. I included Action.h. ...

Memory leak when spliting sentences with strtok

I'm trying to split a string into sentences (delimited by sentence delimiters). The code itself it working but I keep getting memory leaks in the function. char ** splitSentences(char *string) { int sentencecount = 0; char* buf = NULL; char* str = NULL; buf = malloc((strlen(string) + 1) * sizeof(char)); strcpy(buf,string); str = buf...