Ideally, I would connect an ingenico/verifone terminal to the net via an ethernet cable, the terminal will run exclusively a program that I wrote. This program would poll a webservice, beep when it detects some kind of info, wait for somebodys input, transmit said info back to the webservice and print a ticket.
Is this possible with ter...
I was interviewed recently and asked to write mystrcat(*s1, *s2, *s3) where s1 and s2 are source string and the concatenated results are given by s3. I was told, don't worry about memory allocation of s3 and assume s1 and s2 are not null / invalid strings. So I wrote the following lame (crude) program. I was told there is something wrong...
This is a C program that I was using, in the header file I define an offset:
#define LDR_DATA_PATHFILENAME_OFFSET 0x24 // MODULE_ITEM.PathFileName
Later in the program I use it as following:
pImageName = (PUNICODE_STRING)( ((DWORD)(pUserModuleListPtr)) +
(LDR_DATA_PATHFILENAME_OFFSET-dwOffset));
When inspecting the value of ...
With the following piece of code, I get a very wierd result. Why is the last element's value overwriting all previous array elements? i suspect there's a bigger problem than just this immmediate problem.
#include <stdio.h>
main()
{
int i, cases;
char num[1000000];
scanf("%d", &cases);
char* array[cases];
//store...
I am having a VB application request a list of users from a C DLL:
VB will ask the DLL how many users there are, and then initialize an array to the appropriate size.
VB will then pass its array by reference to a DLL function, which will fill it with usernames.
I started writing the C function like this: foo(char **bar); which would be ...
char ARRAY[1024]; // <-- global
Code below works
myFunctionInDll("some string"); // everything ok
Code below doesn't work
myFunctionInDll(ARRAY); // after compilation the entry point of DLL cannot be found
So, to sum up, if I pass a "static string" to my function inside my dll the dll compiles and loads perfectly. However, i...
I stumbled upon this odd result when I was messing around with C arrays:
char s[100] = "hello";
if(s == &s[0]) printf("true. ");
if(s == &s) printf("true.");
// output: true. true.
I know that s holds the memory location of the first element, but is there a way to find the address of s (the address of the pointer that points to the fi...
I'm computing the ordinate y of a point on a line at a given abscissa x. The line is defined by its two end points coordinates (x0,y0)(x1,y1). End points coordinates are floats and the computation must be done in float precision for use in GPU.
The maths, and thus the naive implementation, are trivial.
Let t = (x - x0)/(x1 - x0), then...
I have a library (lib file + .h header file). I like to turn it into a DLL so I can easiliy use it in VB6. Is there a convenient way to do this?
...
I write a program with libcurl.
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
#define URL_MAX 256
int main(int argc, char *args[])
{
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, args[1]);
curl_easy_perform(curl)...
In gcc there is a directive called .align that allows me to align things at boundaries that need to be a power of two. However, on my Intel Core Duo machine I want to align some code (not data) at addresses that are NOT powers of two. Is there any straightforward way to do that?
Because obviously, .align 3 gives me the error: Error: ali...
How do pointers to pointers work in C?
When would you use them?
...
Can I get a threads suspend count under Windows CE, using C or Visual C++, without calling resume or suspend functions? The only way I can see of doing it is something like
int Count = SuspendThread(ThreadHandle);
ResumeThread(ThreadHandle);
This has a couple of problems, firstly, I'd rather not suspend the thread, and secondly the...
I'm reading from the standard input using the read() system call but there's a tiny thing that bothers me. I can't use the arrow keys... What I really wanted to do was to use arrow keys to go back and forth within the typed text but I think that's not that easy... So, what I at least want to do, is to ignore them.
Right now, pressing an...
Hi guys,
I'm having some issue working with V4L (the API that provides unified access to various video capturing for Linux). I'm tryng to make a VIDIOCGCAP ioctl call, but I get an INVALID ARGUMENT error.
Here is an strace:
execve("./test", ["./test"], [/* 26 vars */]) = 0
brk(0) = 0x8d5c000
access("/et...
I have a set of Win32 applications that share information using a shared memory segment created with CreateFileMapping() and MapViewOfFile(). One of the applications is a system service; the remainder are started by the logged-in user. On Windows XP, there was no problem. We named our segments “Global\Something” and all was well.
The a...
I am working on a web controlled rover and am using a serial port to communicate with an Arduino. I wrote some PHP that just uses fwrite() and writes an ascii 1 or an ascii 2 to the serial port. The arduino is listening to that port and does stuff based on what it hears. I know my PHP is working, because whenever I tell it to send stuff,...
How do I set an environment variable in C++?
They do not need to persist past program execution
They only need to be visible in the current process
Preference for platform independent but for my problem only needs to work on Win32/64
Thanks
...
Hi all,
Could someone please tell me if it's possible to burn an 8051 microcontroller with a C++ program?
I've tried searching about it online but can't seem to find out for sure if it's possible or not.
Keil uses C, but the program I need to write is very string-intensive and C is quite string-unfriendly as compared to C# which is wha...
Given a FILE*, is it possible to determine the underlying type? That is, is there a function that will tell me if the FILE* is a pipe or a socket or a regular on-disk file?
...