Hi all,
I am writing a linux testbed for wireless sensor networks. The core objective is to test data transfer between any two nodes. The network runs using tree topology.
One node in the network is the "Driver". This node is connected using serial port to a linux PC. What I am trying to write is the software on this linux PC that will ...
Hello all, I searched the site but did not find the answer I was looking for so here is a really quick question.
I am trying to do something like that :
#ifdef _WIN32 || _WIN64
#include <conio.h>
#endif
How can I do such a thing? I know that _WIN32 is defined for both 32 and 64 bit windows so I would be okay with just it for win...
64bit file API is different on each platform.
in windows: _fseeki64
in linux: fseeko
in freebsd: some another sh.t
How to make it convinient and portable? Any examples?
...
I recently came across some code that looked like:
if(sizeof(var,2) == 4) { ... }
(where var is a type)
I was quite surprised to see what appeared to be two arguments to the sizeof operator. A quick scan of the ISO/ANSI C99 standard did not yield any secrets. I couldn't come up with any reading of the grammar that allowed a comma the...
I have a program that reads in a character array. I need the value of the string in memory to be equal to hex 0x01020304 which are all non-ASCII characters. So the question is, how do I pass non-ASCII characters into a string literal variable at runtime?
...
What is the best way to remove or omit a Lua standard library package? For example remove the os library functions in a particular environment. The project in question is building Lua from the source files so I can edit the source, although I would rather do it through the API if possible.
...
I decided to find out how our C/C+ *nix practitioners use the gdb debugger.
Here is what I typically use:
b - break filename.c:line #, function, filename.cpp:function, className::Member
n, c, s -- next continue step
gdb program name => set breakpoints ==> run [parameter list] (I do this to set break points before the program starts)...
In Lua, using the C interface, given a table, how do I iterate through the table's key/value pairs?
Also, if some table table members are added using arrays, do I need a separate loop to iterate through those as well or is there a single way to iterate though those members at the same time as the key/value pairs?
...
If you do not free memory that you malloc'd in a C program under Linux, when is it released? After the program terminates? Or is the memory still locked up until an unforseen time (probably at reboot)?
...
I know the '-fPIC' option has something to do with resolving addresses and independence between individual modules, but I'm not sure what it really means. Can you explain?
...
So, I'm trying to stuff some default text into a user input using readline, and having trouble getting it to work on OSX 10.5:
// rl_insert_text_ex.c
// gcc -o rl_insert_text_ex rl_insert_text_ex.c -lreadline
#include <stdio.h>
#include <readline/readline.h>
int my_startup_hook(void) {
return rl_insert_text("ponycorns");
}
int main(i...
My char array would be looking something like below,
Org_arr[1first line text------2second line text----3third line-------4--------------------5fith line text------];
where '-' equal to blank spaces
The above array contains the control code(0, 1, 2, 3..) after every 20 characters starting from 0-th place.
I would like to convert th...
Hi, I know this may be a totally newbie question (I haven't touched C in a long while), but can someone tell me why this isn't working?
printf("Enter command: ");
bzero(buffer,256);
fgets(buffer,255,stdin);
if (strcmp(buffer, "exit") == 0)
return 0;
If I enter "exit" it doesn't enter the if, does it have to do with the length of ...
i was wondering if there was a way to add a value to a string, not like 1 + 1 = 2 but like 1 + 1 = 11.
...
so what I'm trying to accomplish is generating 100 random 0's and 1's add them all into one variable and then print it. What I have right now I don't know how to make work. If someone could explain what I'm doing wrong, I would be very grateful.
randstring (void){
int i;
int num;
char buffer[101];
i=100;
while(i>0, i...
I need to write some system log data (usually not more than 100 characters at a time) into a log file based on particular events. But the size of this log file is small (say around 4KB), and I need to wrap around the logs when the file size hits the limit. While wrapping around, I need to preserve the latest info, and later on present it...
I am looking for Blogs that discuss low level programming like assembler, how a .dll loads, how to process links to a .dll, and how a loader maps DLLs into a Process Address Space, among other topics.
Links are appreciated.
...
I'm pretty much positive about this, but just to be on the safe side:
Does the C standard guarantee that AND chains (A && B && ...) will be evaluated left to right, and that evaluation will stop as soon as there's a 0?
Same question for OR. (As soon as there's a 1)
Can I count on this for other C-style languages?
Is this code safe:
...
I am trying to parse text off of a PDF page into sentences but it is much more difficult than I had anticipated. There are a whole lot of special cases to consider such as initials, decimals, quotations, etc which contain periods but do not necessarily end the sentence.
I was curious if anyone here was familiar with an NLP library for ...
I'm writing a ruby extension that defines a class.
If I use Data_Wrap_Struct() to implement my callback for rb_define_alloc_func(), do I need to manually mark and free the instance variables? Or is that still handled for me?
...