Hello,
gcc 4.4.2
I have installed apache runtime portable. apr-1.3.9
./configure
make
make test
make install
Everything installed fine.
I have in my /usr/local/apr/lib all the libraries and the includes in the following /usr/local/apr/include/apr-1
I have a simple main.c program to test:
#include <stdio.h>
#include <apr.h>
int m...
currently I'm building my own script VM manager class in C++, I have no problems with any of the lua & lua C or C++ stuff, but the one section that confuses me is: when to use lua_pop and when to use lua_remove.
From what I understand, lua_pop is to remove multiple values(on the stack) from the top down, eliminating data that is no lon...
Using scanf, each number typed in, i would like my program to
print out two lines: for example
byte order: little-endian
> 2
2 0x00000002
2.00 0x40000000
> -2
-2 0xFFFFFFFE
-2.00 0xC0000000
I can get it to print out the 2 in hex
but i also need a float and of course i cant scanf as one
when i need to also scan as an int
...
I realize that in general the C and C++ standards gives compiler writers a lot of latitude. But in particular it guarantees that POD types like C struct members have to be laid out in memory the same order that they're listed in the structs definition, and most compilers provide extensions letting you fix the alignment of members. So if ...
I'm now really diving into my OS project, called ForestOS, but now I'm needing to dive more into some simple and basic things of C. As now I'm having many problems with the correct variable to use and functions.
I want resources that only talk about variables, functions and how to develop without headers(stdio.h, math.h and all the othe...
I have a function which accepts a pointer to a struct and sets a member of that struct to a specific value. However, after that assignment code is executed, and my program exits without showing any errors.
void swn_addClassToInstance(struct instanceR *instance)
{
instance->classCount = 0;
//nothing below here will run
}
I'm new to C...
From this code I open a socket (server) and listen for incoming request when someone request accept this and save file descriptor (FD) in newsockfd how to extract IP for requester ?
int sockfd, newsockfd, portno, clilen;
portno = 8090;
clilen = 0;
pthread_t serverIn;
struct sockaddr_in serv_addr, cli_addr;
sockfd = socket(AF_INET, SOC...
I need to loop a const char, and I've used a simple example of string loop:
const char *str;
for(int i = 0; i < 10; ++i)
{
str += " ";
}
But when I tried to compile, I got this:
ubuntu@eeepc:~/Test_C_OS$ gcc -o kernel.o -c kernel.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs
kernel.c:26: error: ‘for’ loop initial dec...
I have a function, void funct (struct *B). It will be called by some instances of struct A. It only takes a pointer to strut B and modify that struct B instance. If struct A has char *name. My question is, can I get access to the A_instance->name? in the funct? If yes, how?
Thank you
...
I've got a menu in curses that I'd like to put multi-line descriptions onto.
My code puts the description fields on but they don't display if they don't fit on the line.
Curses is happy enough printing multi-line text as strings (not as menu descriptions)
Any ideas how to get multi-line descriptions working ?
...
The requirements of this are somewhat restrictive because of the machinery this will eventually be implemented on (a GPU).
I have an unsigned integer, and I am trying to extract each individual digit.
If I were doing this in C++ on normal hardware & performance weren't a major issue, I might do it like this:
(Don't hate on me for this...
I am doing a performance comparison test. I want to record the run time for my c++ test application and compare it under different circumstances. The two cases to be compare are: 1) a file system driver is installed and active and 2) also when that same file system driver is not installed and active.
A series of tests will be conducted ...
This code sends and recv s txt file perfectly but cannot do it to otehr formats like .exe or .img. Please help me with these as I need to use htonl or htons??
Take a look!!
Here is the server side recv function ::
if (socket_type != SOCK_DGRAM)
{
fi = fopen (final,"wb");
retval = recv(msgsock, ...
Where can I find a C programming reference that will list the declaration of built-in functions?
Thanks,
-Rob
...
After looking for a way to detect the filetype of a file stream, I found that the Unix file command uses libmagic and I'm trying to make use of the library myself, but I can't get it to work. I've rarely integrated 3rd party code in my own, so that's probably a big part of my problem as well.
Why:
I'm doing this because I have a portab...
Why do I get segmentation fault in this function:
#include <stdio.h>
#include <stdlib.h>
#include "math.h"
vec_t mtrx_multiple (sparse_mat_t a, vec_t c) {
vec_t result;
int i;
result.n = a.n;
printf("result.n: %d\n", result.n);
result.vec = malloc(a.n * sizeof *result.vec);
for(i=0; i<a.n; i++)
resu...
What is the best(fastest) way to determine if a Samba mount point is dead on Linux?
I need to do it in C. System calls like statfs(), statvfs() block for 30-40 sec when called on a stale mount, and they don't even return an error in this case. stat() seems to fail faster then others (about 10 sec) and returns an error. Mount point may g...
I'm writing an application working with plugins. There are two types of plugins: Engine and Model. Engine objects have an update() method that call the Model.velocity() method.
For performance reasons these methods are allowed to be written in C. This means that sometimes they will be written in Python and sometimes written in C.
The p...
In my project I need to use inline Assembly, but it need to be Nasm, because I'm not too much familiar with GAS.
My try:
void DateAndTime()
{
asm
(.l1: mov al,10 ;Get RTC register A
out RTCaddress,al
in al,RTCdata
test al,0x80 ;Is update in progress?
jne .l1 ; yes, wait
mov ...
I have a simple assignment that the professor wants us to do.
Basically to pull in some numbers from a text file and load into a linked list.
I don't want to get to much into the details but I have a basic question.
He provided us with a function like so:
INTLIST* init_intlist( int n )
{
INTLIST *lst;
lst = (INTLIST *)malloc(sizeof(IN...