I am using Bochs 2.4.5 to write a boot sector code. I use the INT 13H to read sectors from floppy. But I found that if the sector count to read > 72, the INT13 will fail. And the return code is AH=1. Below's the code and here is the INT13. The return code is AH=1.
Why can't the INT 13H read more than 72 sectors?
xorb %ah, %ah
xor...
When I use pthread in cocoa, and want to access cocoa control in pthread function(setBtnState), it doesn't work. What's the problem?
The following is the source code:
AppController.h
1 //
2 // AppController.h
3 // PThreadTest
4 //
5 // Created by zhu on 10-9-5.
6 // Copyright 2010 __MyCompanyName__. All rights reserved...
I'm not sure what programming in C really means:
- Programming in pure C with a C compiler
or
- programming in C with a C++ compiler.
Apart from the differences between the C's syntax of C and the C's syntax of C++, can I safely say there are absolutely (or in very few cases) no differences between two executables in terms of performanc...
With reference to the SO thread C Macro Token Concatenation involving a variable - is it possible?,
Is it at all possible to generate variable names at compile-time in C and C++?
something like
int count = 8;
for(i=0; i<count; i++) {
int var_%i% = i*i; // <--- magic here
}
I know I can use arrays for this case, but this is jus...
I am trying to move the float array ptr 256 "units" from the start so (256 * 4 bytes) for floats.
I am receiving a compile time error.
long new_capture_length = 4096;
long step_size = 256;
float data[new_capture_length];
data+=step_size;
error: invalid operands to binary + (have ‘float[(long unsigned int)(new_capture_length)]’ and ‘fl...
How do we implement clrscr() ? googling it I found that "\x1b[2j" can be used to clear the screen but how do we use it?
...
I'm teaching myself C with K&R and am stumped by one of the examples in the book. I compile the code exactly as it is written in the example but it does not do what the authors say it will. The program is supposed to count characters. The code given is as follows:
#include <stdio.h>
/* count characters in input; 1st version */
main(...
I'm working through the problems in Project Euler as a way of learning Haskell, and I find that my programs are a lot slower than a comparable C version, even when compiled. What can I do to speed up my Haskell programs?
For example, my brute-force solution to Problem 14 is:
import Data.Int
import Data.Ord
import Data.List
searchTo = ...
Can someone tell me in plan and simple terms what some of the more important features and options are for gcc and what they do? I look at the man pages and my head feels like exploding lol.
...
Hi.
I am compiling this program on Windows, with gcc (MinGW) and GTK+:
#include <gtk/gtk.h>
void *destroy(GtkWidget *widget, gpointer data)
{
gtk_main_quit();
}
int main(int argc, char *argv[])
{
// Initalize GTK+
gtk_init(&argc, &argv);
// Create GTK+ window
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL...
File1.c
#include<stdio.h>
#include"File2.c"
void test(void)
{
sum(1,2);
}
int main(void)
{
int sum(int a,int b);
test();
sum(10,20);
return 0;
}
File2.c
int sum(int x,int y)
{
printf("\nThe Sum is %d",x+y);
}
Now as far as my understanding goes test() calling sum() should give a compile-time error since I ...
I just wanted to write a program in C to get the Network Interface Card(NIC) details of realtek 8139. would you help me out...
...
This is for the C preprocessor experts:
How can I declare an enum with a list of some identifiers and later during the switch-statement check if an identifier was included in the list?
Example of what I need:
typedef enum { e1, e2, e3, e4, e5, e6 } e;
e x;
switch (x) {
#if DECLARED_IN_ENUM (e1)
case e1 : ...
#endif
/* etc. */
}
...
I've created a linked list class, but this function is producing valgrind errors based saying that there is a conditional jump based upon an uninitialized value in this function. I'm not exactly sure what I need to do to fix it.
Essentially there is a node class for the linked list and this is iterating over all the nodes checking if t...
I'm making a 3D game with OpenGL that basically has a world made entirely of AABB cubes. I created this to make 24 verticie cubes:
void CBox::UpdateDimensions( float w, float h, float d, Vertex3f c )
{
width = w;
height = h;
depth = d;
center = c;
Vertex3f verticies[24];
GLfloat vboverticies[72];
GLfloat vbo...
Hi,
I need to optimize some C code, which does lots of physics computations, using SIMD extensions on the SPE of the Cell Processor. Each vector operator can process 4 floats at the same time. So ideally I would expect a 4x speedup in the most optimistic case.
Do you think the use of vector operators could give bigger speedups?
Thank...
I want to write an application which will intercept some keyboards sequences (like those in Emacs – "C-c C-c") and run some function.
How can I do this in GNOME?
On wich level I should do that (kernel, X11, window manager)?
...
I've written code that should ideally take in data from one document, encrypt it and save it in another document.
But when I try executing the code it does not put the encrypted data in the new file. It just leaves it blank. Someone please spot what's missing in the code. I tried but I couldn't figure it out.
I think there is something...
This equation swaps two numbers without a temporary variable, but uses arithmetic operations:
a = (a+b) - (b=a);
How can I do it without arithmetic operations? I was thinking with XOR
...
I'm trying to implement linked-lists with c struct, I use malloc to allocate a new node then allocate space for value, so I've been thinking how to free the structure once I'm done with them, my structure looks like this:
typedef struct llist {
char *value;
int line;
struct llist *next;
} List;
I have a function that wa...