Hello. I am trying to get more adept and my C programming and I was attempting to test out displaying a character from the input stream while inside of the loop that is getting the character. I am using the getchar() method.
I am getting an exception thrown at the time that the printf statement in my code is present. (If I comment ou...
Hello.
I have written 2 implementation of bubble sort algorithm in C and Haskell.
Haskell implementation:
module Main where
main = do
contents <- readFile "./data"
print "Data loaded. Sorting.."
let newcontents = bubblesort contents
writeFile "./data_new_ghc" newcontents
print "Sorting done"
bubblesort list = sort li...
I need to do a simple thing, which I used to do many times in Java, but I'm stuck in C (pure C, not C++). The situation looks like this:
int *a;
void initArray( int *arr )
{
arr = malloc( sizeof( int ) * SIZE );
}
int main()
{
initArray( a );
// a is NULL here! what to do?!
return 0;
}
I have some "initializing" fun...
When I do:
less /usr/include/stdio.h (which is only a C library - nothing to do with C++)
I see __THROW after quite a few function declarations.
Also, comments above a few functions say that 'This function is a possible cancellation point and therefore not marked with __THROW'
What is all this for?
throw is meant to be for exception ha...
i have never seen a buffer overflow exploit in live action. supporse I have found a server that seems to have vulnerabilities. Where can i get proof of the concept code preferably in c/c++ to exploit the vulnerability? eg i found this vulnerability
Multiple directory traversal vulnerabilities in
functions such as 'posix_access()'...
I have a loop which basically calls this every few seconds (after the timeout):
while(true){
if(finished)
return;
switch(select(FD_SETSIZE, &readfds, 0, 0, &tv)){
case SOCKET_ERROR : report bad stuff etc; return;
default : break;
}
// do stuff with the incoming connection
}
So basically for ...
Hi!
How can I encode a file using sha256 and c/c++ ???
Thanks!
...
I'm a beginner at C, and using Turbo C++ compiler (16 bit).
In the software I'm writing, the maximum answer is around 32000. If I want a number larger than that, I use long int.
If I execute the following program:
#include <stdio.h>
void main()
{
long int x;
x=40000;
printf("%d", x);
}
Then I get an error that the consta...
do
{
printf("Enter number (0-6): ", "");
scanf("%d", &Num);
}while(Num >= 0 && Num <=6);
any ideas?
...
Hello,
I have an arduino with an ethernet shield.
I want to know how can i connect it to internet across a firewall proxy.
e.g the Arduino Ethernet library have only this reference to demonstrate how to connect your board to internet but no clue how to do it across firewall proxy's etc.
Repeated from Arduino help pages.
#include <Et...
Hi,
I have a pointer which points to a function. I would like to:
if (mode == 0)
{
const unsigned char *packet = read_serial_packet(src, &len);
} else {
const unsigned char *packet = read_network_packet(fd, &len);
}
But I cannot do it because my compiler complains when I first use the pointer later in the code.
error...
Where to get streaming (live) video and audio from camera example for Nokia (5800 for ex)?
Suppose I want to create some live video streaming service app so I'll have some cool server at the back end. And I know how to do that part. Suppose I have some stand alone app for PCs now I want to go on to mobile devices. So I decided to start ...
I am tasked with making a queue data structure in C, as a linked list. Our lecturer gave us a large amount of code to implement a stack, but we have to adapt it to create a queue. The code our lecturer gave us ends up not compiling and segfaulting at the exact same point as the code I wrote for the queue. I'm very new to structs, malloc ...
I tried to implement the strcat by myself, and I found the strcat implementation from Wiki like this......but when I use it, there is segmentation fault.
What's wrong with the code below?
char *
strcat(char *dest, const char *src)
{
size_t i,j;
for (i = 0; dest[i] != '\0'; i++)
;
for (j = 0; src[j] != '\0'; j++)
...
I observed that size of long is always equal to the WORD size of any given CPU architecture. Is it true for all architectures? I am looking for a portable way to represent a WORD sized variable in C.
...
#include <stdlib.h>
static inline uint
xchg(volatile unsigned int *addr, unsigned int newval)
{
uint result;
asm volatile("lock; xchgl %0, %1" : "+m" (*addr), "=a" (result) : "1" (newval) : "cc");
return result;
}
Can some one tell me what this code does exactly? I mean I have an idea or the parts of this command. "1" newva...
Does anyone have code snippet for Triple DES algorithm in C ?
Thanks
...
I'm trying to write a wrapper for Winamp input plugins and have hit a bit of a snag. I'd like my wrapper to be able to display a plugin's configuration dialog, which is (or should be) achieved by calling the plugin's Config(HWND hwndParent) function.
For most plugins, this works fine and my program is able to display the plugin's confi...
I am using only C for 5 years.
So I am sure that I know C grammar, but I have no idea how to advance programming skills.
There are many books for modern languages (such as C++, Java) to study programming skills like the refactoring or pattern, software architecture. But no book is written with C language.
The book author say that his/h...
Hello everyone,
I would just like a push in the right direction here with my homework assignment. Here is the question:
(1) Write a C function called input which returns void, this
function prompts the user for input of
two integers followed by a double
precision value. This function reads
these values from the keyboard an...