hi i have the following code below, where i try to get all the lines of a file into an array... for example if in file data.txt i have the following:
first line
second line
then in below code i want to get in data array the following:
data[0] = "first line";
data[1] = "second line"
My first question: Currently I am getting "Segmentat...
Hi,
I am a great fan of the video editing sites animoto (and stupiflex), i enjoy computer graphics and also have that as my major subject at university.
My question is, I have trying to guess what would one need inorder to build such an application.
Do any such open-source / free tools do exist that can give the kind of quality offer...
I am generating C code based on information provided by another file (an XML file). Certain chunks of C are included in this XML file and should be included verbatim in my generated C file. I wish to use the #line directive, so that if these chunks contain an error, the user will see the line number in the XML file that the chunk came fr...
Why it doesn't work :(
I want to simply invoke a shell in C program by execve:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
main()
{
char* path = "/bin/sh";
int err = execve(path, &path, NULL);
printf("%d\n", err);
printf("%s\n", strerror(errno));
printf("%x, %x\n", path, &path);
}
...
Once again, here I am writing C without really knowing what I'm doing...
I've slapped together a simple function that I can call from a C# program that takes a DOT string, an output format, and a file name and renders a graph using Graphviz.
#include "types.h"
#include "graph.h"
#include "gvc.h"
#define FUNC_EXPORT __declspec(dllexpor...
Hey,
What is the result of that line:
int* ptr;
printf("%x, %x\n", ptr, &ptr);
ptr is actually an adress in a memory.
So what is &ptr ??
Thanks in advance
...
ASSERT(pointer);
pointer->x;
In this code, the ASSERT seems to be redundant. If the pointer is NULL, pointer->x will fail anyway. Is my argument correct?
...
Hello Everyone.
I have been looking for a ORM library for C(I was thinking about something like ActiveRecord on Ruby) and I can't find any. I was wondering if someone has ever heard of one and could let me know. Thanks in advance.
Eduardo Sorribas
...
How long does it take to declare a variable in C, for example int x or unsigned long long var? I am wondering if it would make my code any faster in something like this.
for (conditions) {
int var = 0;
// code
}
Would it be faster to do this, or is it easier not to?
int var;
for (conditions) {
var = 0;
// code
}
Tha...
My Code
const int howmany = 5046;
char buffer[howmany];
asm("lea buffer,%esi"); //Get the address of buffer
asm("mov howmany,%ebx"); //Set the loop number
asm("buf_loop:"); //Lable for beginning of loop
asm("movb (%esi),%al"); //Copy buffer[x] to al
asm("inc %e...
This is a combination of my two recent questions:
[1] http://stackoverflow.com/questions/1954494/python-instance-method-in-c
[2] http://stackoverflow.com/questions/1956142/how-to-redirect-stderr-in-python
I would like to log the output of both stdout and stderr from a python script.
The thing I want to ask is, to create a new type acco...
Reading through some great presentations on low latency computing. They had a reference to IBM's XL C/C++ compiler data cache operation __dcbt (Data Cache Block Touch) for their cell compiler. The operation loads a block of memory into L1 cache.
Does Visual Studio (or G++ or Intel) have similar functionality for Intel Processors? If so...
#include <stdio.h>
int main()
{
char temp[1024];
if(getchar() != 'y')
{
printf("no options\n");
return 1;
}
scanf(temp, "%s");
printf("%s", temp);
}
I get snippet as below. I just want twice input from user. but the first input works, however the second dir...
I mean i want the input to be invisible like inputing password when i log in Linux.
How can I implement it both in C under linux and windows.
thanx
...
I'm trying to figure out what would happened if I try to free a pointer "from the middle"
for example, look at the following code:
char *ptr = (char*)malloc(10*sizeof(char));
for (char i=0 ; i<10 ; ++i)
{
ptr[i] = i+10;
}
++ptr;
++ptr;
++ptr;
++ptr;
free(ptr);
I get a crash with an Unhandled exception error msg.
I want to understand...
I want to get the system time including fractional part of the seconds. Is it possible in standard c (ANSI C)?
If not then tell me some libraries for window OS so that I make it possible. In Linux I have the following code with work fine for me.
#include <sys/time.h>
#inc...
If I'm statically linking a GTK+ program under FreeBSD 8, gtk_builder_add_from_file() suddenly returns with an error:
Invalid object type `GtkWindow'
How to fix that? With dynamic linking everything works fine.
Update: linking is done by:
cc -o foobar foo.o bar.o main.o -Wall -pedantic -std=c99 D_THREAD_SAFE -DORBIT2=1 -D_REENTRAN...
Hi
As there several ways to exchange data in the form of strings over sockets, such as e.g:
using functions like:
1) sprintf() and sscanf()
2) snprintf() and sscanf()
3) printf() and strtof()
or converting to char and then pass it as an array
I would appreciate if you could suggest which way and why is efficient and better than ot...
Hi - As a homework problem, I'm working on reading a decimal int from stdin, converting it to a different base (also provided from stdin) and printing it to the screen.
Here's what I've got so far:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num, base, remainder, quotient;
printf("please enter a positive number to...
Hi!
I have an interview coming up in a week's time for an entry level position that involves programming in CUDA (hopefully with C).
I was wondering if anybody can suggest some interview questions that I can expect during the interview.
I have gone through the official programming guide but I'm not all that convenient right now.
Tha...