Using c, I have defined a byte and word as follows:
typedef unsigned char byte;
typedef union {
byte b[4];
unsigned long w;
} word;
This allows me to easy go from words to bytes, but I'm not sure of a good way to go the other way. Is it possible to do something like cast from byte* to word* or do I have to stick with iterative...
HI all,
This is a normal C routine program which i found out in some question bank. It is shown below:
#define CUBE(p) p*p*p
main()
{
int k;
k = 27 / CUBE(3);
printf("%d", k);
}
As per my understanding and knowledge the value of K should be 1 as CUBE(3) would be replaced by 3*3*3 during preprocessing and after the subseq...
time_t rawtime;
struct tm *mytm;
time_t result;
time(&rawtime);
mytm=localtime(&rawtime);
mytm->tm_mon=month-1;
mytm->tm_mday=day;
mytm->tm_year=year-1900;
mytm->tm_sec=0;
mytm->tm_min=0;
mytm->tm_hour=0;
result = mktime(mytm);
Above code snippet,I'm expecting result to display the no.of seconds lapsed since 1970,jan-1st for th...
Hi,
Is there any place where i could get some materials to know about ASN.1.
I want to know about the syntax's to be used and also some examples to get some overview.
Any help is appreciated.
...
My code uses a text based conf file with key=value type entries. I want to add sections feature for file, i.e. search for number of sections, search for particular key in a section.
I was wondering if there are any libraries/functions which already does this, that I can reuse. My suspicion is yes, since lot of gnu software uses such fil...
How can I call two C applications from within another C application?
e.g. :
pg1.c can be run as ./a.out pg1_args
pg2.c can be run as ./a.out pg2_args
I would like to write a program that can be run as:
./a.out pg1_args pg2_args
With the result being equivalent to :
./a.out pg1_args
./a.out pg2_args
./a.out pg1_args
./a.out ...
This company have a interesting cpu that run in a amazing speed.
Will it be possible to emulate c or is the memory to small?
http://www.greenarrays.com/home/products/index.html
So someone that have tried to emulate c in forth may have a answer.
...
What are the various mechanisms using which we can detect if a process execution is leading to memory fragmentation?
Are there any tools available for the same? Suggestion for tools which work with 'C' code and can run on Windows, Linux and VxWorks will be helpful.
...
Hi,
We have to add a new interface to our existing C application. The new interface system requests to our C application and responses to interface will be XML files. We need find a way to read and write XML files. It seems there are many mapping tools available for Java and C++. I did not find anyone for C.
Please let me know if ther...
I want to do something in C99 one way, otherwise to perform it another way. What is the #define to check for?
#ifdef C99
...
#else
...
#endif
...
With C/C++ macros it's quite easy to generated long constructs automatically. For example, if I want a huge set of methods to not ever throw exceptions (a must for COM-exposed methods) I can do something like this:
#define BEGIN_COM_METHOD\
try{
#define END_COM_METHOD\
return S_OK;\
} catch( exception& ) {\
// set I...
Is there a way in Visual Studio, either through it's native features or a plugin, to show an integer/long/char variable in the debugger window as a bit array? For example, rather than seeing 5 or 0x5 I'd like to see 101. As a bonus feature I'd like to see them left-padded with the correct amount of zeroes, so that the total width of the...
Hello folks, i'm making an Itunes plugin with an embed browser attached to it.
I can see it, and it works perfectly, but it can't receive mouse inputs!
I think that itunes is getting all the inputs for it...
anyone knows a way to solve this?
...
In an objective-c/cocoa app, I am using c functions to open a text file, read it line-by-line and use some lines in a third-party function. In psuedo-code:
char *line = fgets(aFile);
library_function(line); // This function calls for a utf-8 encoded char * string
This works fine until the input file contains special characters (such ...
Given this code:
int *p, *q;
p = (int *) 1000;
q = (int *) 2000;
What is q - p and how?
...
/*
* code.c
*
* TASK
* Reverse a string by reversing pointers. Function should use return
* type char* and use a char* parameter as input.
*/
#include <stdio.h>
#include <string.h>
#define STRMAX 51
char* reverse(char* sPhrase[]);
int main() {
char sPhrase[STRMAX];
char sReverse[STRMAX];
printf("Enter string...
I want to do some sound synthesis on Mac OS X (and ideally other Unix-like OS) using ANSI C.
This is for learning purposes rather than "I need a solution, any solution, quick!"
Say I have an 8-bit buffer in my C program that I update 22050 times a second. How can I get my speakers to output that as a waveform?
...
FILE *fd;
if (fd=fopen(fileName,"r") == NULL)
{
printf("File failed to open");
exit(1);
}
This is a code snippet. When I compile it with gcc, i get the following warning:-
warning: assignment makes pointer from integer without a cast
When I put fd=fopen(argv[2],"r") within brackets, the problem gets solved..
I am not abl...
I have a script vbs wich redirect some data to the stdin of myApp (written in C in Windows).
If myApp was already launched before myApp finds the PID of the first myApp session and redirects the input received via stdin to the stdin of the first session of myApp which handles the stdin.
So when myApp receives a stdin and no other instanc...
I'm trying to return an array of char*'s to a function. I've simplified my code to a test case that clones a char array that instead of containing chars holds pointers to those chars.
/*
* code.c
*/
#include <stdio.h>
char* makePointerCopy(char cIn[]);
int main() {
char cTest[] = {'c', 't', 's', 't'};
char* cPTest[] = makePo...