I am working on a simple application written in C. I am working in a Unix environment.
My application is doing some simple I/O. I use printf to prompt the user for some input and then use scanf to get that input.
The problem is, I don't know how to tell my application that I am ready to proceed after entering in a value. Typing 'enter'...
Where is ptrdiff_t defined in C? If non-trivial, how can I make this type visible from GCC on Linux?
...
I am writing a program that creates ICC color formats. These formats specify a data type called s15Fixed16Number which has a sign bit, 15 integer bits and 16 fractional bits. IEEE 754 32-bit floats have a sign bit, 8 exponent bits and 23 fractional bits.
I need to get input from a text box, and convert them into a s15Fixed16Number. Some...
Hi guys.
I am trying to access the element asd7 inside the innermost structure, here is my code:
#include <stdio.h>
int main()
{
struct asd
{
int asd;
struct asd1
{
int asd1;
struct asd6
{
int asd7;
}asd6;
}asd1;
}asd;
int asd10;
int asd11;
struct asd *ptr1;
struct asd1 *ptr2;
struct asd6 *ptr3;
asd.as...
I want to set the maximum of connection. If it more than the maximum, tell the client now server is full and close the socket.
How to write code in C ?
Thank you.
...
Hello
gcc 4.4.3 c89 pthreads
I use valgrind for checking memory errors.
I am just wondering if there is any tool for linux that can detect running threads that haven't been terminated after the program finishes.
I am running a multi-thread application and need a tool to make sure all threads have finished.
Many thanks for any sugg...
Can anybody please help me showing how to set an environment variable and start a process in ANSI C for Windows? If possible I want to avoid using any windows API for this.
...
Hello, first(as always) I want to apologize about my english, it may not be clear enough.
I'm not that good at C programming, and I was asked to read a "string" input with undefined length.
This is my solution
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *newChar();
char *addChar(char *, char);
char *readLine(void...
int main()
{
int x = 2, y = 6, z = 6;
x = y == z;
printf("%d", x);
}
...
How can I load the batch file console to my C console?
I know in batch The command is Showme.bat /B and it'll load the console into whatever console you called that file from.
What would that be in C?
ShellExecute(NULL,"open","Showme.bat",NULL,NULL,SW_SHOW);
Also, doing that... How could I also add additional arguments such as
>>...
What's the best way to suppress "unused parameter" warning in C code.
For instance,
Bool NullFunc(const struct timespec *when, const char *who, unsigned short format, void *data, int len)
{
return TRUE;
}
In C++ I was able to put /.../ around the parameters. But not in C of course.
It gives me "error: parameter name omitted".
So...
Hi,
We have followed the regex for validating RFC 2822 standard.
The function is as follows:
int isValidEmail(const char *email_id)
{
/* Regular expression to validate email */
const char *reg_exp =
"[a-z0-9!#$%&'*+-/=?^_`{|}~]+(\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9]([a-z0-9-]*[a-...
Hi,
I am confused with this program.
#include <stdio.h>
int main(void)
{
char* ptr="MET ADSD";
*ptr++;
printf("%c\n", ptr);
ptr++;
printf("%c\n", ptr);
}
Here's the output.
ET ADSD
T ADSD
My question is how does the pointer displays the rest of the characters?
Thanks.
...
When my code is in a blocking recv call, if the other side reboots, then this side recv call doesn't get to know about it and just goes into a hung state.
How to avoid this?
...
I have created a communication library which is linked statically into several different applications. The library provides support for communication via different kinds of hardware. Some of the hardware is supported from the vendor via a shared library. On systems without those kinds of hardware, the shared library is not available.
Pr...
Hi,
I do have say #if A in code and made a lib.
Now for some reason i do want to take out code from lib containing #if A without recompiling the lib.
Can i do this using some command.
Regards,
Kiran
...
Hi,
I have a static variable declared in a file:
static char *msgToUser[] = {
"MSG1 ",
"MSG2 ",
};
Inside one of the methods of a class I'm doing this:
void InfoUser::ModifyMsg( BYTE msgIdx, char *msgString ){
strncpy( msgToUser[ idx ], msgString, DISPLAY_SIZE );
}
When I do the strncopy ...
Hello. I'm trying to rewrite this asm code in C, but my asm knowledge very bad.
struct
{
union
{
struct{
WORD ShiftZ0;
WORD ShiftZ1;
WORD ShiftZ2;
WORD ShiftZ3; };
struct{
DWORD ShiftZ01;
DWORD ShiftZ23; };
};
short ShiftZ0Align;
short ShiftZ1Align;
short ShiftZ2Align;
short ShiftZ3Align;
int deltaZ0...
I have the following code:
#include <stdio.h>
int main(void)
{
int x = 2, y = 6, z = 6;
x = y == z;
printf("%d", x);
}
output is = 1
Why?
...
Hi there,
I'm looking for a NoSQL-way to store machinedata like information about tools, work pieces, products, operations and so on... Currently I'm concentrating on BerkeleyDB and need input from you guys, whether I should consider using another nosql-database which might fit better on my requierements. Data stored in this db should b...