I´m currently writing a software in Ansi-C and are struggling to get one of the basic functionality to work.
The software will receive messages over a CAN-network and when these messages arrive, I need to make sure that they are delivered before a expected time and after the previous message.
Only unsigned variables are allowed to be u...
I've recently started working on developing APIs written in C. I see some subroutines which expect 8(Eight) parameters and to me it looks ugly and cumbersome passing 8 parameters while calling that particular subroutine. I was wondering if something more acceptable and cleaner way could be implemented .
...
I'm trying to write a full screen application for Windows CE 5.0. I'm using CEGCC under Linux to compile my application, so I'm restricted to Windows API - i.e. no fancy GUI designer stuff, no Visual Studio, no MFC, no .NET.
So far, I tried Microsoft's example using SHFullScreen, but no luck. I do not want to hide the taskbar globally (...
I want to read FBX binary format, but I want to not use FBX sdk of Autodesk.
Please teach when someone knows that web sites of fbx binary file format.
...
I'm compiling parallel C code on a cluster (HECToR).
Although I won't be running any parallel jobs interactively, my code contains some references to X11 functions which are used when it's run sequentially. The cluster I'm using doesn't support shared libraries, which rules out X11, at least in the way I've been using it so far.
Could ...
i am trying to create a function like strlen() in string.h
It's giving me the error can not convert char* to char
#include<stdio.h>
#include<conio.h>
int xstrlen(char string);
void main(void) {
char string[40];
puts("Enter string:");
gets(string);
printf(" %s is the length of %d", string, xstrlen(string));
}
int xstrlen(cha...
Which version of ANSI C standard does Turbo C 3.0 follow wholly or partly?
C89 or C90 ?
...
The default limit for the max open files on Mac OS X is 256 (ulimit -n) and my application needs about 400 file handlers.
I tried to change the limit with setrlimit() but even if the function executes correctly, i'm still limited to 256.
Here is the test program I use:
#include <stdio.h>
#include <sys/resource.h>
main()
{
struct rl...
HI all,
I would like to call from my C# code, unamanaged library functions like presented below. There are two options and the both works. In this moment "Beep" function is simple and have no input/output parameters, pointers, references... I am wondering in more complex cases what would be adventages and disadvantage of both approches ...
Hello.
I've made a small application in C with Netbeans.
I've ran the application in Netbeans and it created an exe.
I used that exe and it worked fine on my comp but when I move it to other comp it says:
"This application failed to start because cygwin1.dll was not found. Re-installing the application may fix this problem."
How can i c...
Hi all,
I have the following code:
#include <stdlib.h>
#include <stdio.h>
#define SIZE 100
int* arr;
main()
{
int i;
arr = (int*)malloc(SIZE*sizeof(int));
if (arr == NULL) {
printf("Could not allocate SIZE(=%d)", SIZE);
}
for (i=0; i<SIZE; i++) {
arr[i] = 0;
}
free(arr);
}
I wan't to...
I was browsing some code and I came across this macro definition
#define D(x) do { } while (0)
And its used in the code like this,
D(("couldn't identify user %s", user));
I ran the code, and that particular line doesn't do anything. So, why would some one define a macro like that?
In case you're wondering, that macro is defined in...
I have a FILE *, returned by a call to fopen(). I need to get a file descriptor from it, to make calls like fsync(fd) on it. What's the function to get a file descriptor from a file pointer?
...
i made a program to convert lowercase strings to upper case like strupr(); in strings.h ..its printing some ascii code when ever i run the program
#include<stdio.h>
#include<conio.h>
void xstrupr(char string[]);
void main(void)
{
char string[40];
puts("Enter string:");
gets(string);
xstrupr(string);
printf(" %s ",s...
Why doesn't this C program compile? What is wrong with this?
I have tried it on wxDevC++ and Turbo C++ 3.0.
Main.c
#include<stdio.h>
#include<conio.h>
const int SIZE = 5;
int main(int argc, char ** argv)
{
char array[SIZE] = {'A', 'B', 'C', 'D', 'E'};
printf("Array elements are,\n");
int i=0;
for(i=0 ; i<SIZE ;...
I want to make a program that forces it's user to input text but doesn't allow him to erase any of it, what's a simple way of doing it in C?
The only thing I've got is (c = getchar()) != EOF && c != '\b' which doesn't work. Any ideas?
...
With the following code va_arg is returning garbage for the second and third pass through vProcessType.
// va_list_test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <tchar.h>
#include <cstdarg>
#include <windows.h>
void processList(LPTSTR str, ...);
void vProcessList(LPTSTR str, va_list ar...
I have a very strange problem when reading a binary file.
void metaDataProcess(FILE *f){
unsigned __int32 obLength;
unsigned __int32 numProp;
char* objPath;
unsigned __int32 rawDataIndex;
int level;
fread(&obLength,sizeof(obLength),1,f);
objPath=new char[obLength];
cout<<"i am at"<<ftell(f)<<endl;
fr...
Hello,
gcc 4.4.4 c89
-Wall -Wextra
I have the following
size_t i = 0;
uint32_t k = 0;
printf("i [ %lu ] k [ %u ]\n", i, k);
I get the following warning when compiling:
format ‘%lu’ expects type ‘long unsigned int’, but argument has type ‘uint32_t’
When I ran this using splint I got the following:
Format argument 1 to printf (...
int main()
{
enum Days{Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday};
Days TheDay;
int j = 0;
printf("Please enter the day of the week (0 to 6)\n");
scanf("%d",&j);
TheDay = Days(j);
//how to PRINT THE VALUES stored in TheDay
printf("%s",TheDay); // isnt working
return 0;
}
...