Hi, I have the following declaration in my code:
u32 volatile __attribute__((nocast)) *A, *B;
Is this equivalent to:
u32 volatile __attribute__((nocast)) *A;
u32 volatile __attribute__((nocast)) *B;
or:
u32 volatile __attribute__((nocast)) *A;
u32 volatile *B;
or even:
u32 volatile __attribute__((nocast)...
I'm trying to send a raw packet using UDP, with the IP and UDP headers that I have constructed in my code. Raw packet successfully initialized with socket(PF_INET, SOCK_RAW, IPPROTO_UDP) and socket option set using setsockopt(sd, IPPROTO_IP, IP_HDRINCL, val, sizeof(int)).
The problem is when I send the packet using sendto(), I get the e...
my parent process is unable to catch the SIGCHLD even though its on waitpid(SIGCHLD... for it.
Tried giving an explicit kill(SIGCHLD..) to the parent from the child to test the parent is not receiving the signal .also the flavor is AIX...do we need to compile it with some flags or some env setup ?
...
I did a big oops, but the file is still open and in use.
Following (http://stackoverflow.com/questions/1178593/link-to-a-specific-inode),
copying from the /proc/###/fd/### to a new file is not useful because:
the file is changing
The filesize is 40G and the disk is full (150MB free)
I am attempting to relink it to the filesystem (u...
Hi
I am pretty new to C. I recently came across this piece of code in C:
#include <stdio.h>
int main()
{
unsigned Abc = 1;
signed Xyz = -1;
if(Abc<Xyz)
printf("Less");
else
if(Abc>Xyz)
printf("Great");
else
if(Abc==Xyz)
printf("Equal");
...
I've gotten the gist that the following
<T> my_function(...) {
....
}
is preferred by most, compared to:
<T> my_function(...)
{
....
}
Likewise for:
if (...) {
...
}
being preferred over
if (...)
{
...
}
Is this true and if so, why is the former style preferred over the latter?
...
What is the behavior of various systems when you have more than one copy of a particular program or library running, do string literals get stored once in RAM or once for every copy of the process/library? What if they are stored in an array like:
static const char *const foo[] = { "bar", "baz", "buz" };
Does the static change the beh...
Hello. Just a quick question: What are people's practices when you have to define the (arbitrary) maximum that some array can take in C. So, some people just choose a round number hoping it will be big enough, others the prime number closer to the round number (!), etc., other some more esoteric number, like the prime number closer to......
I can think of some nasty inefficient ways to accomplish this task, but I'm wondering what the best way is.
For example I want to copy 10 bytes starting at the 3rd bit in a byte and copy to a pointer as usual.
Is there a better way than to copy one shifted byte at a time?
Thanks
...
Hi,
Can we open a new terminal tab or window from the existing terminal using a makefile or some c file.
If yes how? Thanks in advance for replying.
P.S. I want to do this because first in the terminal I want to run the server file then I want to open the new terminal and there run the file for the client.
From the second terminal I ...
I want to scan a 2D array with the help of pointers and have written this code, could you tell me why the compiler gives errors?
#include<stdio.h>
#include<stdlib.h>
int main(void) {
int i,j,n,a,b;
int (*(*p)[])[];
printf("\n\tEnter the size of the matrix in the form aXb\t\n");
scanf("%dX%d",&a,&b);
p=(int (*(*p)[b])...
Hi, I have few very simple question. I searched a web for them, but I found different answers so I just want to know which to follow.
So, first, I believe WinMain is NOT C or C++ standart, but is only added by Microsoft to determine when to load different CRT startup code, am I right?
And second, is WinMain called by OS, in a way of le...
We have a situation we want to do a sort of weighted average of two values w1 & w2, based on how far two other values v1 & v2 are away from zero... for example:
If v1 is zero, it doesn't get weighted at all so we return w2
If v2 is zero, it doesn't get weighted at all so we return w1
If both values are equally far from zero, we do a me...
I'm after a very tiny XML parser for an embedded project. It needs to compile down to 10-15k, doesn't need to validate, and needs to be simple and portable.
...
Hi All,
I am trying to suspend my system using a c++ program using SetSuspendState method but I am facing issue during linking.
I am using g++-4 (GCC) 4.3.4 20090804 (release) 1 compiler on Windows 7 OS (64bit).
The code I have written is
#include <iostream>
#include "windows.h"
#include "powrprof.h"
using namespace std;
int main()...
Basically I would like to convert a bitmap to a png using libpng but rather than outputting it to a FILE* I would like to output it to a char*. I have already seen this related post but I don't see where the bitmap data is actually used. Any help would be appreciated.
...
I'm starting development of a series of image processing algorithms, some of them with intensive use of queues. Do you guys know a good benchmark for those data structures?
To narrow the scope, I'm using C mostly, but I can use C++, stl and any library.
I've got a few hits on data structure libraries, such as GLib and C-Generic-Library,...
Hi all,
I'm fairly new to C so sorry if this is a stupid question but when I run the following code:
#include <stdio.h>
int main () {
int i;
int test[10];
char string[81];
for(i = 0; i < 10; i++){
scanf("%d", &test[i]);
}
for(i=0; i < 7; i++){
gets(string);
printf("String was entered\...
This is sort of a strange question, but oh well.
I feel like writing a (rich) text editor mainly to be used for note-taking, in either C or C++, using most probably GTK or Qt for the UI.
The problem is that I can't really decide what to use. I know both C and C++, C a little better. I've never used Qt but I'm completely fine with learn...
I've read a lot of other topics on this site about the same problem knowing it would be common. But I guess I'm dumb and can't figure out the proper way to do it. So, I apologize for yet another one of these questions and I'm hoping someone can give me a simple solution and/or explanation.
Here's the entire code:
Main.c
#define WIN32_...