I have set up pipes to redirect stderr and stdout. When I use printf, does it send data to stdout or to stream 1?
If it sends it to stdout, how can I instead configure it to send data to stream 1?
...
What integer hash function are good that accepts an integer hash key?
...
Why does this code:
#include <stdio.h>
int main(int argc, char** argv) {
printf("%lld\n", 4294967296LL);
}
emit this for Windows:
0
but this for Linux:
4294967296
...
There is this post for .Net, but it is not really informative. Any other suggestions? This must be a duplicate, though my first cursory search only turned up the one I already mentioned.
Duplicate of:
Option Parsers for c/c++?
Best way to parse command line arguments in C#
...
I've been working in C# for a while now (about 2 years). I started out programming in C++ but just learned about pointers/classes/etc..., then moved to C#. I've always wanted to learn C but thought it was too much of a challenge for what people were telling me was an almost dead language. I'm a Linux user (GNOME) and want to make some GT...
Hi all! I'm doing this class assignment, using classic C, and am stuck with this problem about callback functions that take variable arguments count and type.
Basically, I'm working on a Hashed Tree (a tree where each of the nodes is a hash tree), and I have a certain traversal strategy that will be used multiple times for different pur...
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp = fopen("lr.txt", "r");
fseek(fp, 0L, SEEK_END);
int size = ftell(fp);
fseek(fp, 0L, SEEK_SET);
char *lorem_ipsum;
int i = 0;
lorem_ipsum = (char*) malloc(sizeof(char) * size);
while(fscanf(fp, "%s\n", lorem_ipsum) != EOF)
{
...
My project is in C, CodeBlocks is my IDE and i´m running on windows Vista. I need to apply a Butterworth Filter to my data. I could do this automatically with Matlab as it had this (and other) Filter as a built in function. Computers and programming aren´t exactly my area and i have never "imported" a new library, and dont know how to do...
Duplicate (or near duplicate):
Problem compiling K&R example
Lately I have been working my way through the C Programming Language by K&R.
In section 5.11 they cover pointers to functions and after typing in their example -- a quicksort implementation where we provide a pointer to the comparison function we want to use -- I'm getting a...
My first attempt of reverse for loop that does something n times was something like:
for ( unsigned int i = n-1; i >= 0; i-- ) {
...
}
This fails because in unsigned arithmetic i is guaranteed to be always greater or equal than zero, hence the loop condition will always be true. Fortunately, gcc compiler warned me about a 'po...
Suppose I have a number of C static libraries say libColor.a which depends on libRGB.a which in turn depends on libPixel.a . The library libColor.a is said to depend on library libRGB.a since there are some references in libColor.a to some of symbols defined in libRGB.a. How do I combine all the above libraries to a new libNewColor.a whi...
After I accept() a connection, and then write() to the client socket, is it better to write all the data you intend to send at once or send it in chunks?
For example:
accept, write 1MB, disconnect
…or…
accept, write 256 bytes, write 256 bytes, … n, disconnect
My gut feeling tells me that the underlying protocol does this aut...
Greetings Everyone.
I'm currently writing a multi-language programe in C, C++ and fortran on UNIX, unfortunatly I run into "Segmentation Error" when I try and execute after compiling.
I've narrowed down the problem to the interface between the C++ and C sections of my program. The first section consists of main.ccp and SA.cpp, and the...
Today i came across nested functions which i had never heard of. Is it only part of GNU C?
Here is a wikipedia example of nested function.
float E(float x)
{
float F(float y)
{
return x + y;
}
return F(3);
}
From the code, it looks like nested functions are sort of C++ inline functions. So, is it possible to t...
Here's my code:
// Not all headers are relevant to the code snippet.
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <cstdlib>
#include <cstring>
#include <unistd.h>
char *buffer;
stringstream readStream;
bool readData = true;
while (readData)
{
cout << "Receiving ...
Hi,
I'm trying to execute something at the end of a function just before it returns to the caller.
To Do so, I would like to override return in a certain context. The behavior should be the same as __cyg_profile_func_exit, but I would like to activate it only for some functions.
I don't know if it's possible using gcc builtins or this ...
Greetings Everyone
I am currently trying to write a multi-language program (C, C++ and fortran) though am achieving segmentation errors. I've ruled out vectors and the like in: http://stackoverflow.com/questions/666320/accessing-public-class-memory-from-c-using-c
I've narrowed now the cause to the use of 'cout' experssions in my C++ se...
I have this code:
#include <iostream>
#include <mp4.h>
int main (int argc, char * const argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
MP4Read("filename", MP4_DETAILS_ALL );
return 0;
}
And i've added -I/opt/local/include and -L/opt/local/lib to the path (where the mp4 library resides after install...
While reading a binary file using DJGPP on DOS this code hangs.
This happens when the fread call is made. If the call is removed then the program runs successfully.
The same code runs fine through Visual C++ 2008.
Has anyone experienced similar issues with djgpp ?
Am I missing out on something really simple ?
char x;
string Filena...
I wrote this really nice app that works just fine in Linux.
It uses strptime(). Windows doesn't have this.
Is there a Windows alternative for this?
My coworker needs to use this app.
(I tried googling it already to no avail)
...