Does ** have any special meaning in C?
Like this:
static intparse_one (int argc, char **argv)
{
cmd_line *slot;
int value;
Flag_name flag_name;
int i;
printf("argv %s\n",argv);
printf("argv[0] %c\n",**argv);
If so, does the line
**argv
make sense? A program I am trying to get to ru...
I have a Dllmain that allocates Thread local storage when a thread attaches to this DLL. Code as below:
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
LPVOID lpvData;
BOOL fIgnore;
switch (ul_reason_for_call)
{
case DLL_PROCESS_A...
It seems like I should be able to perform bit shift in C/C++ by more than 32 bits provided the left operand of the shift is a long. But this doesn't seem to work, at least with the g++ compiler.
Example:
unsigned long A = (1L << 37)
gives
A = 0
which isn't what I want. Am I missing something or is this just not possible?
-J
...
How do I reliably get the size of a C-style array? The method often recommended seems to be to use sizeof, but it doesn't work in the foo function, where x is passed in:
#include <iostream>
void foo(int x[]) {
std::cerr << (sizeof(x) / sizeof(int)); // 2
}
int main(){
int x[] = {1,2,3,4,5};
std::cerr << (sizeof(x) / sizeof...
I'm trying to compare two strings. One stored in a file, the other retrieved from the user (stdin).
Here is a sample program:
int main()
{
char targetName[50];
fgets(targetName,50,stdin);
char aName[] = "bob";
printf("%d",strcmp(aName,targetName));
return 0;
}
In this program, strcmp returns a value of -1 when ...
Abstract: Can you propose a mathematical-ish algorithm over a plane of pixels that will generate a moderately interesting image, preferably one that on the whole resembles something?
The story thus far:
Once upon a time I decided in an effort to reduce cycle waste on my (admittedly too) numerous computers, and set out to generate image...
While at university I started my first programming with ANSI C, before we moved onto Java later in the course. Now I would like to go back to (re)learning C and C++ again to allow me to contribute with open source projects and also to expand my CV and improve my career prospects.
Currently I mostly program in VB.net (I know I know, I t...
Is there currently a group working on the next C standard (by next, I mean after C99)? If so, what are the features likely to make it in?
...
So I realize this question sounds stupid (and yes I am using a dual core), but I have tried two different libraries (Grand Central Dispatch and OpenMP), and when using clock() to time the code with and without the lines that make it parallel, the speed is the same. (for the record they were both using their own form of parallel for). T...
Working on a simple C program I'm stuck with an if test:
int line_number = 0;
if ((line_number >= argv[2]) && (line_number <= argv[4]))
gcc says:
cp.c:25: warning: comparison between pointer and integer
cp.c:25: warning: comparison between pointer and integer
What can I do to properly check the range of lines I want to deal with?...
I'm trying to sort a GLib hash table by id that looks something like:
key - id
{
"Red", 2,
"BLue", 4,
"Yellow", 5,
"Orange", 8
}
I'm just not sure how to approach this because GLib does not have a sort method. I was thinking to use qsort or GCompareFunc
Any ideas will be appreciate it!
...
I'm trying to use the ACE_Service_Object or the ACE_Shared_Object. I'm not sure which one is applicable. I'm trying to encapsulate some functionality in a DLL so a consumer of the DLL would open the library, create an instance of the exported class, call some functions on the class, and then destroy the class. A basic plug-in architec...
I'm trying to save the address of a dynamic array index. The last line of this function is what gives the pointer error.
static struct sstor *dlist
struct node *ins_llist(char *data, struct llist *l) {
struct node *p, *q;
q = malloc((size_t)sizeof(struct node));
if(q == NULL)
return(NULL);
if(ins_list(data, &dli...
I want to make an application in c or c++ which have to monitor some specific processes. Kindly guide me how I can make it possible in c.
...
I came across this page: Plotting Tools
where I found a set of tools with the name stats.pl and make-cdf. I can write my own but don't want to spend too much time when someone else has already done that. Does anyone have these tools or at least point me to a similar set of tools somewhere?
...
I have a readline-based application with a prompt, however I'd like it to not show when the input is not interactive.
$ ./readline-app < command-list > result
$ cat result
prompt> Output line 1
prompt> Output line 2
prompt>
$
How can I make the prompt to not print in this case?
...
Consider the following code:
int main()
{
int *p;
++((int){5}); //compile without err/warning
&((int){5}); //compile without err/warning
++((char *)p); //Compile-time err: invalid lvalue in increment
&((char *)p); //Compile-time err: invalid lvalue in unary '&'
}
Why do the Compound Literals do not ...
This is my warning.
implicit declaration of function 'exit'
How i can remove it.
i am using linux & gcc compiler.
...
I'm kind of confused here. Im using a mac trying to develop an opengl game. The Opengl frame work is dynamically linked. So therefore i need to force static or bundle it right? Wait, wait, i read that opengl is on all macs now, yet there's extra stuff u get if u install Xcode.(i have it installed).
Anyways, I want this to work on OSX, w...
I want to disable keyboard when my program Run, means that no one can use alt+F4 etc. How I can make it possible using c in window OS.
...