Hi
Can anybody help me in finding out how to verify that _tmkdir succeeded.
For example i wish to create a file within another folder. This folder i will create at runtime. So i will give the following command.
sFilePath = sFilePath + _T("\\P-Series Communication Logs");
_tmkdir( sFilePath );
where sFilePath would initially contain a...
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
// int
char str[40],ch;
FILE*fp,*fp1,*fp2;
fp=fopen("ide_input","w");
fp1=fopen("error_log","w");
fp2=fopen("lex_output","w");
if(fp==NULL || fp1==NULL)
{
strcpy(str,"file cannot be found");
fputc(str,fp1);
}
w...
Why might using a "long long" in C or C++ be a bad thing?
I was compiling a runtime library the other day and in the code it checks to see if longs are 64bits and if not it uses a long long. But along with that, it sends out a #warning "using long long". I can't think of any reason for the "long long" being a warning unless it was lefto...
I need help with this sample application. When I run it, it gets stuck after the child process prints "Child sending!".
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#define INPUT 0
#define OUTPUT 1
int main()
{
int fd1[2];
int fd2[2];
int pid;
if (pipe(fd1) < 0)
...
Hello,
I'm looking for a program or library that I could use for experimenting with board games (chess mostly, but not necessarily -- other similarly complex board games
are OK too). I'll test different game-playing algorithms.
This is what I need:
I'd like, if possible, to make my program play against
players like gnuchess and craft...
I recently got my home PC upgraded to a quad-core CPU and 64-bit OS. I have some former experience with C/C++ and I'm really "itching" to try exercising some 64-bit CPU capabilities. What's a good "Hello World" type program that demonstrates 64-bit multi-core capabilities by doing some simple things that don't work well at all in 32-bit ...
Hi, the following is a very very simple version of malloc() and seems to allocate some space to me, but apart from the fact that there is no free() and I don't check if I've overrun the allocated space, how can I check that the code is correct?
Any obvious blunders that "C" experts would slap me for?
#include <stdio.h>
#include <unistd...
I've searched all over the web and can't seem to find documentation or even a simple explanation of what PyAPI_DATA() does (even though it is used in the Python header files and cited on python.org). Could anyone care to explain what this is or point me to documentation I am overlooking?
Thanks.
...
Suppose struct_name is the name of a struct I've defined, and array is a member in the struct defined as char array[o]
what does the following line produce? (*struct_name).array
an address location?
...
I write a 'constructor' function that makes a Node in C, compiled with Visual Studio 2008, ANSI C mode.
#include <stdio.h>
#include <stdlib.h>
typedef struct _node
{
struct _node* next ;
char* data ;
} Node ;
Node * makeNode()
{
Node * newNode = (Node*)malloc( sizeof(Node) ) ;
// uncommenting this causes the program to fail.
...
I've allocated a chuck of memory with char* memoryChunk = malloc ( 80* sizeof(char) + 1); What is keeping me from writing into the memory location beyond 81 units? What can I do to prevent that?
void testStage2(void) {
char c_str1[20] = "hello";
char* ut_str1;
char* ut_str2;
printf("Starting stage 2 tests\n");
strcat(c_str1, " wor...
I am trying to write some inline assembly into C. I have two arrays as input, what I need is to copy one element in array1 into array2, and the following is what I have at the moment:
asm (
"movl %0,%%eax;"
"movl %1,%%ebx;"
"movl (%%eax),%%ecx;"
"movl %%ecx,(%ebx);"
"xor %%ecx,%%ecx;"
"movl 4(%%eax),%%ecx;"
//do something on %ecx...
Hi,
How would you go about converting the following C #define into c#.
#define get16bits(d) (*((const uint16_t *) (d)))
#if !defined (get16bits)
#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
+(uint32_t)(((const uint8_t *)(d))[0]) )
#endif
I know you probably re...
I have an Objective C project incorporating a C file with some helper functions. I have a grave and very irritating problem trying to return floats from the C file.
C file:
float returnFloat() {
return 10.0;
}
Meanwhile in an Objective C instance method:
float x;
x = returnFloat();
x is always 0.000000. Any ideas what I'm doin...
I am working on reviving an old project (that only works with < 5.1) that essentially compiles PHP 5.3 into a PE C++ EXE. I have gotten everthing to work really well on multiple Windows 7 computers with only 2 dlls and 1 exe for most applications! Unfortunately, on XP I get:
the application failed to start because the application con...
I am currently writing a C application and I need to display the following symbols in the terminal : ≥ and ≤
Their ASCII character codes are 242 and 243 but I can't get them to be displayed in the DOS terminal.
Any ideas on how I can do this?
...
I want to pass an array of arbitrary struct pointers and a comparison function to a generic sorting algorithm. Is this possible in C?
The goooeys of the structs would only be accessed within the comparison function, the sorting function would only need to call the comparison function and swap pointers, but I can't figure out how to decl...
The example code of section 10.6, the expected result is:
after several iterations, the static structure used by getpwnam will be corrupted, and the program will terminate with SIGSEGV signal.
But on my platform, Fedora 11, gcc (GCC) 4.4.0, the result is
[Langzi@Freedom apue]$ ./corrupt
in sig_alarm
I can see the output from ...
Hello, I am trying to understand a code, what exactly
&(ipA[iLower + 1] stands for in the below code (partition function of a quicksort?
void Partition(int* ipA, int iSize) {
// Partitions of size 0 or 1 are already sorted
if (iSize <= 1) {
return;
}
// Select a pivot from the array randomly
int iPivot = ip...
Hello there,
I wonder how a can include an pre-compiled binary in an iPhone application.
I can't compile it inside XCode, I can only have the binary compiled for arm.
I tried the execve function, but always reports "Operation not supported", I thought it was something with file permissions, but even setting +x perm got the same error.....