I am integrating a medium-sized (10,000 or so lines) program written in C into a C++ program. I have created a new class, BWAGenome as an interface to the C code, so any access to the C functions is encapsulated. I am compiling everything with the g++ compiler. The .o files are all generated correctly, but when I attempt to link them tog...
It's error. What's wrong of my codes?
#include "stdafx.h"
#include "stdlib.h"
#include "ctype.h"
int _tmain(int argc, _TCHAR* argv[])
{
FILE* input;
int num;
int numCount = 0;
input = fopen("123.txt", "r");
if (!input)
{
printf("No file \a\n");
exit (101);
}
while ((fscanf(input, "%d", &num)) == 1)
...
My problem is quite infuriating, actually. I'll show you the code first.
/*
** listener.c -- a datagram sockets "server" demo
*/
//Original Code: Brian Hall ([email protected])
//Commented and modified by Vishal Kotcherlakota (PID A07124450)
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#i...
Has anyone dealt with re-distributing an application that uses the Numerical Algorithms Group (NAG) Libraries?
It seems like when I build an executable, it won't run unless I have an environment variable set for the license file- i.e. if I gave someone the code they would need a license and associated daemon as well.
Is there no way a...
How to interpret complex declarations like :
int * (* (*fp1) (int) ) [10]; --->declaration 1
int *( *( *[5])())(); -------->declaration 2
Is there any rule that should be followed to understand the above declarations?
...
I need to write to an executable file that is being executed, but I can't open it for writing. For example:
#include <stdio.h>
#include <fcntl.h>
int main(int argc, char **argv)
{
int fd = open(argv[0], O_RDWR);
if (fd == -1) perror(NULL);
return 0;
}
% uname -rs
FreeBSD 8.0-STABLE
% ./example_ETXTBSY
Text file busy
Th...
what is the difference between %d and %i when used in printf function ?
...
Hi,
I'm reading in a .txt file. I'm using fscanf to get the data as it is formatted.
The line I'm having problems with is this:
result = fscanf(fp, "%s", ap->name);
This is fine until I have a name with a whitespace eg: St Ives
So I use this to read in the white space:
result = fscanf(fp, "%[^\n]s", ap->name);
However, when I try ...
Using Cocoa or basic c, how can I convert a double to a string representation and then convert it back to the exact same double. Readability is not important, only accuracy.
For example, will this work:
double a,b;
a=some value;
b=[[[NSNumber numberWithDouble:a] stringValue] doubleValue];
...
Hello,
do you use any particular site for function reference or you just google the function?
...
This is a quick question, I did a search but couldn't find anything that answered my question.
When doing a recursive function in C do you need to have a return even when using a void function?
Eg:
void addToLL(structA_ptr new, structA_ptr cur) {
if (cur->next == NULL) {
cur->next = new;
} else {
...
I am new to programing and I have been hearing a lot about how C is a non-object-oriented language and how java is an object-oriented language I was wondering what the difference was?
Thank you.
...
I'm trying to figure out how to get the most recent latitude and longitude of a Twitter user (from the new Geo API data, ie the <geo:point> tag, you can see how they look like on my twitter user timeline xml feed). I also need to retrieve how old that data is (in seconds) from the <created_at> tag.
I'm trying to write this in C to use w...
What does this line mean? I havn't done C in a few years. Does it perform the operation in parens then make the int result a pointer??
b[0] = *(start + pos++);
...
I have some C code that I'd like to port to java. I haven't done much C coding, but I was able to follow along up until this one function. If anyone could help me understand what is going on, it would be greatly appreciated.
int reverse_integer(int input) {
int output = 0, i;
for ( i=0, i<sizeof(int); i++ ) {
output =...
Is there a way to get a C stream object (a FILE* object) that points at nothing?
I know fopen("/dev/null","w"); would work but I'm wondering if there is a better way.
Preferably that bit buckets the data at a higher level than the posix layer and that is also more portable.
...
EDIT: Clarifying.
fout is is a FILE*. (I thought this was irrelevant since that line clearly compiles)
there is A LOT of code above these last few lines; I guess I could dump them all but I imagine you're not overly interested in debugging my stuff. I'm more interested, generally, in what could possibly occur that would segfault at...
I have a C program which compiles and runs fine under Linux without any warnings, but when trying to compile it on SunOS, I get the following warning:
test.c: In function `my_function':
test.c:412: warning: implicit declaration of function `strerror_r'
Undefined first referenced
symbol ...
I am writing the calloc function in a memory management assignment (I am using C). I have one question, I wrote the malloc function and thinking about using it for calloc as it says calloc will take num and size and return a block of memory that is (num * size) which I can use malloc to create, however, it says that I need to initialize ...
I have an FCGI application that have to stream audio via HTTP. The audio is composed of 1 to 3 files mixed together. Everything is in plain C.
I'd like to know what will be a good way or library to read the audio files by 1 second chunks, mix them and encode them as an HTTP friendly format.
I need to read the files by chunks because I ...