Hi,
I found this example code and I tried to google what int (*)[])var1 could stand for, but I got no usefull results.
#include <unistd.h>
#include <stdlib.h>
int i(int n,int m,int var1[n][m]) {
return var1[0][0];
}
int example() {
int *var1 = malloc(100);
return i(10,10,(int (*)[])var1);
}
Normally I work with VLAs in...
I'm reading through the LZMA SDK source code and noticed that they assign pointers passed into a method to themselves - example (from the SDK, C/Util/7z/7zAlloc.c):
void *SzAlloc(void *p, size_t size)
{
p = p; <-- !
if (size == 0)
return 0;
#ifdef _SZ_ALLOC_DEBUG
fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, ...
Given some MathML content:
<apply>
<eq/>
<ci>c</ci>
<apply>
<plus/>
<ci>a</ci>
<ci>b</ci>
</apply>
</apply>
and
std::map<std::string,std::double> cal;
cal["a"] = 1.;
cal["b"] = 2.;
cal["c"] = 0; // does not matter what c is
I wish to evaluate the MathML and retrieve the results. Is there a C/C++ library that ca...
Intellisense in Visual Studio 2010 interprets C code as C++ and marks errors where they don't exist, as in:
struct my_struct *s = malloc(sizeof *s);
which is valid C, but not valid C++.
Is there any way to fix this?
...
Hi folks,
I am looking for an open source cross-platform library for working with the serial port in C, something along the lines of the awesome pyserial library (Unfortunately I have to use C for this application)
I have only found this one: http://www.teuniz.net/RS-232/ and that doesn't seem to have mention OSX compatibility.
Any re...
Why run this code and print whole string?
#include <stdio.h>
void main()
{
int a;
while(a!='q')
{
scanf("%c",&a);
printf("%c",a);
}
}
Enter string except q, and finally press enter key. Only now your string will print on the screen. Why?
...
Quick Summary:
I have an array of 24-bit values. Any suggestion on how to quickly expand the individual 24-bit array elements into 32-bit elements?
Details:
I'm processing incoming video frames in realtime using Pixel Shaders in DirectX 10. A stumbling block is that my frames are coming in from the capture hardware with 24-bit pixel...
I am new to the XML and parsing. Just started!
Using Expat XML Parser in C on Linux i.e. libexpat.so and expat.h.
I would like to know that, is it possible to parse the xml file (elements, attributes and its values or strings) and create or map it as structure i.e. to form the structure from XML data available in the XML file???
Is there...
I wonder about the use of the static keyword as scope limiting for variables in a file, in C.
The standard way to build a C program as I see it is to:
have a bunch of c files defining functions and variables, possibly scope limited with static.
have a bunch of h files declaring the functions and possibly variables of the corresponding...
Hi
coming from this question "What does (int (*)[])var1 stand for?" I tried to access the result of the cast like a multidimensional array. But I get following error: "assignment from incompatible pointer type" followed by a segmentation fault. I tried also some other variations, but none of them worked. How can I access the elements in...
I am programming in C in Unix,
and I am using gets to read the inputs from keyboard.
I always get this warning and the program stop running:
warning: this program uses gets(), which is unsafe.
Can anybody tell me the reason why this is happening?
...
I have been playing around with trying to implement some protocol decoders, but each time I run into a "simple" problem and I feel the way I am solving the problem is not optimal and there must be a better way to do things. I'm using C. Currently I'm using some canned data and reading it in as a file, but later on it would be via TCP or ...
I'm working on application using the math computation. For my code I need to know how to cover all paths of code of libraries I'm using. The one of not covered yet is in k_rem_pio2 file. The kernel function have branch for ih==2 numbers and then ther is an
if(carry!=0) -z= scalbn(one,q0);
my question is for what number the i...
I need to get text from an entry in a dialog, like a login dialog (get the user and password), I've tryied to use 'gtk_entry_get_text' but I did something wrong or there's something else I could use...
I'm programing in C... please help me...
...
What are these data types for? __m64, __m128,
__m256 ?
...
I'm using OpenGL to render polygons. I notice that if I minimize the program then start using it again, it will be very slow for a few seconds. (I'm guessing its reuploading my display lists to the card). How can I prevent this because it's a bit annoying. I want it to always have the contents.
Thanks
...
hy
I'm trying to port a KDE application to windows
my problem is finding a suitable KDE SDK for windows, i can't include any k-headers (kapplication.h kaction.h ....) and I haven't even got to the libs
is there a guide for doing things like this
...
I am currently writing a PE parser/loader.
I have successfully loaded the PE file into memory using standard c file io, retrieved valid DOS and PE headers (the optional header) as well as gaining access to the PE's sections.
My next target is to gain access to the Export table to retrieve exported symbols.
To do this i have used the RVA ...
I'd like to receive (and later process) write(1) and wall(1) messages using a (Unix 98-style) pseudo tty on Linux.
I already have the following minimal implementation:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <utempter.h>
#define BU...
My company develops a hypervisor, and this question concerns use of AMD's SVM (Secure-Virtual-Machine) API.
I'd like to track exactly how many instructions have executed in my guest operating system in a given period. AMD has kindly provided so-called "HO" and "GO" or "HostOnly" and "GuestOnly" bits in the PerfEvtSel MSRs (0xc0010000.....