Hi,
I want to open a text file (see below), read the first int in every line and store it in an array, but I get an segmentation fault. I got rid of all gcc warnings, I read through several tutorials I found on the net and searched stackoverflow for solutions, but I could't make out, what I am doing wrong.
It works when I have everythi...
I've got 32-bit registers with field defined as bit-masks, e.g.
#define BM_TEST_FIELD 0x000F0000
I need a macro that allows me to set a field (defined by its bit-mask) of a register (defined by its address) to a given value. Here's what I came up with:
#include <stdio.h>
#include <assert.h>
typedef unsigned int u32;
/*
* Set a gi...
Trying to get some basic understanding of console functionalities. I am having issues so consider the following...
#include "stdafx.h"
#include<iostream>
#include<conio.h>
using namespace std;
/*
This is a template Project
*/
void MultiplicationTable(int x);
int main()
{
int value = 0;
printf("Please enter any number \n\n"...
I'm making a drawing application with WINAPI and OpenGL. To make things more efficient I only redraw the region needed so I invalidateRect(hwnd,myRect,false).
I know OpenGL does self clipping but I want to do that for my rect. I want it to clip itself for the region I invalidated to make things even more efficient. Thanks
...
I am writing an eclipse plug-in which will operate in a mode in which it will need to send "commands" to another C program. The C program has a built-in poller which checks for events. The plug-in will "push" commands out but doesn't need anything in response. What's the easiest way to set up a communication mechanism between these two? ...
I’ve run my code in a variety of circumstances which has resulted in what I believe to be odd behavior. My testing was on a dual core intel xeon processor with HT.
No OpenMP '#pragma' statement, total runtime = 507 seconds
With OpenMP '#pragma' statement specifying 1 core, total runtime = 117 seconds
With OpenMP '#pragma' statement sp...
I'm unfortunate enough to be stuck using VS 2010 for a project, and noticed the following code still doesn't build using the non-standards compliant compiler:
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
char buffer[512];
snprintf(buffer, sizeof(buffer), "SomeString");
return 0;
}
(fails compilation with the...
Is there a way of converting a char into a string in C?
I'm trying to do so like this:
char *array;
array[0] = '1';
int x = atoi(array);
printf("%d",x);
...
Why is dereferencing called dereferencing?
I'm just learning pointers properly, and I'd like to know why dereferencing is called that. It confused me as it sounds like you are removing a reference, rather than going via the pointer to the destination.
Can anyone explain why it is called this?
To me something like destination or pointe...
I always wanted to know what is the real thing difference of how the compiler see a pointer to a struct (in C suppose) and a struct itself.
struct person p;
struct person *pp;
pp->age, I always imagine that the compiler does: "value of pp + offset of atribute "age" in the struct".
But what it does with person.p? It would be almost th...
Possible Duplicate:
How do I call unmanaged C/C++ code from a C# ASP.NET webpage
is there a way to link the two?
...
I can get the system time using struct tm and time(),localtime(),asctime().but i need help about how i can set time of system using c program.
...
I am currently upgrading our software to support ipv6 and in the meantime I'm expanding hostname/ip fields to the max hostname size. In sun documentation it seems like this can be up to 1025 (netdb.h:#define NI_MAXHOST 1025 - this is the recommended hostname allocation define), but when I pass a hostname of over 255 to getaddrinfo I get ...
I'm programming in C++. I need to convert a 24-bit signed integer (stored in a 3-byte array) to float (normalizing to [-1.0,1.0]).
The platform is MSVC++ on x86 (which means the input is little-endian).
I tried this:
float convert(const unsigned char* src)
{
int i = src[2];
i = (i << 8) | src[1];
i = (i << 8) | src[0];
...
Is it possible to retrieve an integer using scanf and assigning each digit to a int array?
I'm trying to achieve it doing it this way:
int numbers[];
puts("Enter number");
int x;
scanf("%d",x);
numbers = malloc(x);
numbers = x;
...
when I have syntax on in a large C file (about 8000) lines
the completion ctrl-p and ctrl-n are very slow (more than 20). When I turn syntax off then completion takes less than a second.
Any ideas on how to solve this?
Thanks!
EDIT:
I figured out a minimal way of reproducing this behaviour:
with an empty .vimrc and .vim folder the on...
Would somebody please tell me whats wrong with this code
I am just calling a Sleep function from the kernel32.dll
What's wrong?
I am using Visual Studio 2008.
Any help would be grateful.
Thank you very much.
__asm
{
mov eax, 77e2ef66h
push 9999
call eax
}
...
I'm trying to get the frames (properly decoded) and the frames delay times from an animated gif. I've opened up the code to gifsicle and have also tried lungif but I'm not accustomed to c code and I'm having a difficult time following the logic. I've also tried other examples and I've gotten one to work but it didn't do the proper LZW ...
Hi, I am looking for some basic information regarding makefile structure. Any pointers will be highly appreciated. Thanks.
...
I would like to safely be able to simulate open with O_CREAT | O_WRONLY | O_TRUNC | O_NOFOLLOW and O_CREAT | O_WRONLY | O_APPEND | O_NOFOLLOW on systems that do not support O_NOFOLLOW. I can somewhat achieve what I am asking for with:
struct stat lst;
if (lstat(filename, &lst) != -1 && S_ISLNK(lst.st_mode)) {
errno = ELOOP;
retu...