I'm fairly new to C++ sockets.
Is there a book for beginners for C++ socket programming?
for windows i really need help ive been through alot of tutorials dont get any of it and im using dev-C++
...
Could someone explain to me why the mask is not shifted to the right at all? You can use anything in place of that 1 and the result will be the same.
unsigned mask = ~0 >> 1;
printf("%u\n", mask);
...
I'm reading source code of the linux tool badblocks. They use the read() function there. Is there a difference to the standard C fread() function? (I'm not counting the arguments as a difference.)
...
The definition of the UNIX open() function when used with the O_CREAT flag is that it requires a third argument named mode in order to set the files' privileges.
What if that mode is not specified?
int file;
static const char filename[] = "test.test";
if ((file = open(filename, O_RDWR | O_CREAT | O_TRUNC)) == 1)
{
perror("Error o...
This has some lengthy background before the actual question, however, it bears some explaining to hopefully weed out some red herrings.
Our application, developed in Microsoft Visual C++ (2005), uses a 3rd party library (whose source code we luckily happen to have) to export a compressed file used in another 3rd party application. The ...
I am using fopen fseeko64 ftello64 fclose etc. to operating on a file.
How can I truncate a file? I know that there is no standard way to do this in C. All I want is some way that will work on any win32 platform. I'm using mingw gcc to compile.
Please note: I meant truncate the size of the file to a specified size, not make it 0 size. ...
I'm assuming that the good old qsort function in stdlib is not stable, because the man page doesn't say anything about it. This is the function I'm talking about:
#include <stdlib.h>
void qsort(void *base, size_t nmemb, size_t size,
int(*compar)(const void *, const void *));
I assume that if I change my comparison...
Duplicate: http://stackoverflow.com/questions/69539/have-you-used-any-of-the-c-interpreters-not-compilers/
I was wondering if there is something like an interpreter for C. That is, in a Linux terminal I can type in "python" and then code in that interpreter. (I'm not sure interpreter the right word). This is really helpful for testin...
I want to reopen the stdin and stdout (and perhaps stderr while I'm at it) filehandles, so that future calls to printf() or putchar() or puts() will go to a file, and future calls to getc() and such will come from a file.
1) I don't want to permanently lose standard input/output/error. I may want to reuse them later in the program.
2) ...
Im programming win32 using fopen fread fwrite in C.
How can I force windows to write data through to the disk? Is than an API call for this?
I have a program that must absolutely make sure that data is saved to disk before it saves to a different indexing file, otherwise if there are crashes the index file can sometimes update but the ...
like 17, is a prime, when reversed, 71 is also a prime.
We manage to arrive at this code but we cant finish it.
#include <stdio.h>
main()
{
int i = 10, j, c, sum, b, x, d, e, z, f, g;
printf("\nPrime numbers from 10 to 99 are the follwing:\n");
while (i <= 99)
{
c=0;
for (j = 1; j <= i; j++)
{...
Hello,
If i want to use something like below in a C code:
if(num < 0x100000000LL)
I want the comparison to happen on a long long constant, but suffix LL doesn't work in MSVC6.0 , but it works in MS Visual Studio 2005.
How can i get it working in MSVC 6.0?
-Ajit
...
Hi everyone !
I'm currently trying to integrate some animation drawing code of mine into a third party application, under the form of an external plugin.
This animation code in realtime 3d, based on OpenGL, and is supposed to render as fast as it can, usually at 60 frames per second.
In my base application, where I'm the king of the w...
I'm currently working on cross-platform applications and was just curious as to how other people tackle problems such as:
Endianess
Floating point support (some systems emulate in software, VERY slow)
I/O systems (i.e. display, sound, file access, networking, etc. )
And of course, the plethora of compiler differences
Obviously this i...
When reading files off of a hard drive, mmap is generally regarded as a good way to quickly get data into memory. When working with optical drives, accesses take more time and you have a higher latency to worry about. What approach/abstraction do you use to hide/eliminate as much latency and/or overall load time of the optical drive as p...
I am writing a C++ DLL that is called by an external program.
1.) I take an array of strings (as char *var) as an argument from this program.
2.) I want to iterate through this array and call a COM function on each element of the string array. The COM function must take a BSTR:
DLL_EXPORT(void) runUnitModel(char *rateMaterialTypeName...
I'm trying to print types like off_t and size_t. What is the correct placeholder for printf() that is portable?
Or is there a completely different way to print those variables?
...
I would like to know what projects cannot be done in C.
I know programming can be quicker and more intuitive in
other languages. But I would like to know what features
are missing in C that would prevent a project from being
completed well.
For example, very few web-frameworks exist in C.
...
"va_end - Macro to reset arg_ptr".
After accessing a variable-argument list, the arg_ptr pointer is usually reset with va_end. I understand that it is required if you want to re-iterate the list, but is it really needed if you aren't going to? Is it just good practice, like 'always have default: in switch'?
Edit: Answered by greyfade, t...
Hello all,
I am using bitfields to get easy access on a float library I am trying to make for a microcontroller with no FPU.
The problem is that I can't seem to make it work with bitfields. Take a look:
typedef struct
{
union{
unsigned long mantissa: 23;
unsigned long exponent: 8;
unsigned long sign: 1;
float all;
...