I'm trying to write a simple program that will receive a string of max 20 characters and print that string to the screen.
The code compiles, but I get a bind() failed: 10038. After looking up the error number on msdn (socket operation on nonsocket), I changed some code from
int sock;
to
SOCKET sock
which shouldn't make a differe...
Hello,
I have 3 files in my gtk+ app:
main.c:
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "mainwindow.h"
int main(int argc, char** argv)
{
MainWin* win;
GError* err = NULL;
int a = 0;
a = some_foo();
gtk_main();
return 0;
}
mainwindo.h
#include <gtk/gtk.h>
typedef struct _MainWin
{
Gtk...
hello.
i tried to read text file in xcode but this
"EXC_BAD_ACCESS message showed up when i tried to build my program
here is my code
and i put inputA.txt file in the same folder with project file
my friend told me that i should put txt file in debug folder is this why i cannot read txt
file in this code? please help me...
macbook user...
This question is inspired by this question, which features the following code snippet.
int s;
if((s = foo()) == ERROR)
print_error();
I find this style hard to read and prone to error (as the original question demonstrates -- it was prompted by missing parentheses around the assignment). I would instead write the following, which ...
I am trying to encapsulate my Win32 application into a class. My problem occurs when trying to initiate my primary window for the application below is my declaration and implementation... I notice the issue within my class method InitInstance();
declaration
#pragma once
#include "stdafx.h"
#include "resource.h"
#define MAX_LOADSTRING 1...
Hi everyone,
I'm working on a project sending serial data to control animation of LED lights, which need to stay in sync with an animation engine. There seems to be a large serial write buffer (OSX (POSIX) + FTDI chipset usb serial device), so without manually throttling calls to write(), the software can get several seconds ahead of th...
I want to draw many polygons to the screen but i'm quickly noticing that it slows down quickly. As a test I did this:
for(int i = 0; i < 50; ++i)
{
glBegin( GL_POLYGON);
glColor3f( 0.0f, 1, 0.0f ); glVertex2f( 500.0 + frameGL.GetCameraX(), 0.0f + frameGL.GetCameraY());
glColor3f( 0.0f, 1.0f, 0.0f ); glVertex2f( 9...
I am reading a book and I am not sure if its a mistake or I am misunderstanding the quote. It reads...
Nowadays every PC you can buy has
hardware that can render images with
at least 16.7 million individual
colors. Rather than have an array with
thousands of color entries, the images
instead contain explicit color values
...
Possible Duplicate:
how many color combinations in a 24 bit image
I am reading a book and I am not sure if its a mistake or I am misunderstanding the quote. It reads...
Nowadays every PC you can buy has
hardware that can render images with
at least 16.7 million individual
colors. Rather than have an array with
thou...
I was wondering if I can use a library -written in C++- in C#
The problem is that library has its own structures and classes..
Will I be able to use it in C#?
Thanks
EDIT This library is open source..
so if my requirements needs something special in C++ code, I will be able do it...
...
I need to execute a file when I only know the descriptor. It is also possible that there are no links to the file so finding out the name somehow is not an option. All the execve(), execvp(), etc functions take a file name. dlopen() also takes a name.
Ugly solutions (like reading the file and calling some function pointer) are OK.
...
Basically what I'd like to do is make textured NGONS. I also want to use a tesselator (GLU) to make concave and multicontour objects.
I was wondering how the texture comes into play though. I think that the tesselator will return verticies so I will add these to my array, that's fine. But my vertex array will contain more than one poly...
I'm writing a mobile phone based game in c. I'm interested in a data structure that supports fast (amortized O(1) if possible) insertion, look-up, and removal. The data structure will store integers from the domain [0, n] where n is known ahead of time (it's a constant) and n is relatively small (on the order of 100000).
So far I've c...
I am programming in C, using the Windows API, and would like to know how I could draw separators.
I'm a total noob when it comes to writing GUI applications, so I may need a code example.
Edit: Here's an illustration...
...
The Size of pointer depends on the arch of the machine.
So
sizeof(int*)=sizeof(int) or sizeof(int*)=sizeof(long int)
I want to have a custom data type which is either int or long int depending on the size of pointer.
I tried to use macro #if, but the condition for macros does not allow sizeof operator.
Also when using if-else, typed...
Many are familiar with the hello world program in C
#include <stdio.h>
main ()
{
printf ("hello world");
return 0;
}
Why do some precede the main () function with int as in:
int main()
Also, I've seen the word 'void' entered inside the () as in:
int main(void)
It seems like extra typing for nothing, but maybe it's a be...
Hi!
A quick question I've been wondering about for some time; Does the CPU assign values atomically, or, is it bit by bit (say for example a 32bit integer).
If it's bit by bit, could another thread accessing this exact location get a "part" of the to-be-assigned value?
Think of this:
I have two threads and one shared "unsigned int" var...
I'm a C noob and I just found out that atoi is deprecated in favor of strtol etc.
Where can I find a list of deprecated C functions ?
...
I am trying to create my render target view but I get this error from direct X
A RenderTargetView cannot be created from a NULL Resource
To my knowledge it seems that I must fill the rendertarget pointer with data before passing it. But I am having trouble figure out how. Below is my declaration and implementation
declaration
#prag...
Hi there,
I have this piece of code and i don't know how it works
#include <stdio.h>
int main(void)
{
int numero = ({const int i = 10; i+10;});
printf("%d\n", numero); // Prints 20
return 0;
}
Why if i delete the second part (i+10;), the compiler gets an error?
Why are the brackets necessary?
Thank you ^^!
...