Hi there,
Programming for my Arduino (in some kind of mix of C/C++), I noticed something weird.
Everytime I communicate through the serial port, I keep an eye on the SRAM usage. Normally, it ranges between 300~400 bytes.
However, after adding a new routine (see below), I noticed it always jumped from 300~400 bytes of free memory to EXA...
This is in relation to a homework assignment but this is not the homework assignment.
I'm having difficultly understanding if there is a difference on how the bitwise not (~ in C) would affected signed int and unsigned int when compiled on a big endian machine vs. a little endian machine.
Are the bytes really "backwards" and if so do...
We're developing something for the Windows platform and we'd like to harness the multiple cores present in PCs nowadays.
I know that in VS2010, there is the Concurrency Runtime. It's still on Beta, though. For the meantime that we do need to release quality code now, what is a good option for an API that will allow smooth transition la...
Is there any speed- and cache-efficient implementations of trie in C/C++?
I know what a trie is, but I don't want reinvent the wheel, implementing it myself.
...
Is it a good idea to use IEEE754 floating point NaN (not-a-number) for values which are undefined for non-mathematical reasons?
In our case they are not yet set because the values have not been received from some other device. The context is an embedded system using IEC1131 REAL32 values. Edit: The programming language is C, so we would...
Hey,
I want to read cartesian coordinates of a large set of points from of a .txt file into a matrix or some such data structure using a C program.
The file has contents of the type
023 435 1.0
23.5 12.5 0.2
: : : : : :
: : : : : :
and so on...
There are about 4000 such co-ordinates in the file. First column i...
I am trying to write a sample Raw socket program to clear my understanding of raw sockets. I create a Raw UDP socket and then call sendto. My sendto succeeds but I never see the packet received by the other side. I dont have any receive side running so I am relying on Wireshark running on both the sender and receiver.
I am pasting the co...
I intend to write a small application to scratch a personal itch and probably make the life of some colleagues easier. Here is what I have:
10+ years of experience in C
Plenty of experience in programming against the Win16/32 API in C from the Win3.1 to 2000 days.
C library written by myself already doing about 75% of what the applicat...
Hello all,
I'm trying to check if a web site is up and running. I'm currently doing this with UserAgent library in Perl with timeout 1. However, it is still too slow for me.
I call the script every five minutes from cron. There are lots of links to check and the script takes more than five minutes to complete execution. So, I need a mo...
After reading a few related questions I've decided to use the tpl library to serialize my structures in order to send and receive them through sockets. I'm having trouble understanding how to send and receive the tpl images using sockets. I get a segfault error on the server side when I call the tpl_dump function.
I know the sockets ar...
I am using IIRF - an ISAPI rewrite filter for pretty URL's. I haven't been able to get much help from the developer on these issues. I'm hoping by making some sense of this dump, so I can find the problematic area in the code and rebuild it myself. I am not super familiar with C, but can get around. Do I need to build this with debug sym...
This is the code that I want to try to write:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
int main(int argc, char *argv[])
{
float arry[3] = {0};
memset(arry, (int) 10.0, 3*sizeof(float));
return 0;
}
My problem is that I want to see if it's possible to use memset to ...
Hello,
I'm trying to build a hello world using GTK, which includes the line:
#include <gtk/gtk.h>
as you would expect.
The Makefile supplied has the line:
GTK_INCLUDE = -I/usr/local/include
so it would expect to find gtk.h in /usr/local/include/gtk/gtk.h. However on my system, it is located in /usr/local/include/gtk-2.0/gtk/gtk.h...
Alright, this one's been puzzling me for a bit.
the following function encodes a string into base 64
void Base64Enc(const unsigned char *src, int srclen, unsigned char *dest)
{
static const unsigned char enc[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
unsigned char *cp;
int i;
cp = dest...
Does the FILE type used through standard C functions fopen, etc. have an object-oriented interface?
I'm looking for opinions with reasoning rather than an absolute answer, as definitions of OO vary by who you ask. What are the important OO concepts it meets or doesn't meet?
In response to JustJeff's comment below, I am not asking wheth...
Does Endianness matter at all with the bitwise operations. Either logical or shifting?
I'm working on homework with regard to bitwise operators and I can not make heads or tails on it and I think I'm getting quite hung up on the endianess. That is, I'm using a little endian machine (like most are) but does this need to be considered or...
I have a question about constructing bitmasks in C. I need to mask out the least-significant half of a 'long int', so that I am left with only the upper half. I need to ensure that it masks out half no matter if I am on a 64-bit or 32-bit platform. I see that __WORD_SIZE is defined in limits.h. Initially I am doing it like this:
#de...
I just spent way too long trying to diagnose why, in the following snippet of code, the ProcessEvent() method seemed to be ignoring the false value I passed in for aInvokeEventHandler:
HRESULT
CEventManager::
Process(Event anEvent)
{
return (m_pPool->GetFsm()->ProcessEvent(anEvent), false);
}
// Definition of ProcessEvent()
HRESUL...
Hello,
I don't know if this is true, but when I was reading FAQ on one of the problem providing sites, I found something, that poke my attention:
Check your input/output methods. In C++, using cin and cout is too slow. Use these, and you will guarantee not being able to solve any problem with a decent amount of input or output. Use...
Using Visual Studio 2005, I wrote a simple DLL in C that uses the Windows API to send UDP datagrams and that is hooked into a third-party program. On a 64 bit machine, it does not work at all, as the third-party code was compiled for 64 bit in this case. So I need to ship two versions of the same DLL - one for 32 bit, one for 64 bit.
Ho...