Hey hey,
I am trying to wrap my head around C right now (mostly how pointers operate). I am trying to write this function described below:
/* EnterName enter a Name into a symbol table. Returns a
boolean indicating whether an entry for Name was
already listed in the table. Passes back an argu...
I have a function which is called multiple times during the program's execution. In said function, I have a dynamic character pointer which I resize numerous times.
My question is: do I need to free this pointer before the end of the function?
void functionName()
{
char *variable = (char *) malloc(0);
//variable is resized with re...
I want to write a video encoding. What do I need to do?
...
I am using something like this:
char *file;
file = (char *)malloc(BUFSIZE * sizeof(char));
printf("Enter the filename:");
scanf("%s", file);
if(remove(file)) {
printf("Error while removing");
}
I created two files:
touch filetobedeleted1.txt
chmod 777 filetobedeleted1.txt
touch filetobedeleted2.txt
chmod 444 filetobedeleted2.txt
...
I am currently writing a matrix multiplication on a GPU and would like to debug my code, but since I can not use printf inside a device function, is there something else I can do to see what is going on inside that function. This my current function:
__global__ void MatrixMulKernel(Matrix Ad, Matrix Bd, Matrix Xd){
int tx = threadI...
Hi i use DEV C++ compiler in windows xp sp2 and recently i downloaded the IPP libraries. I installed successfully , i set up the compiler directories from option menu to IPP directories but when i try to compile an ITT program i get linker error for the ITT functions. Is there a solution?
...
Hey folks,
I just read this http://stackoverflow.com/questions/2172887/use-c-struct-in-objective-c question, and I was wondering why anyone would want to use function pointers in structs.
Wouldn't wrapping the functions in a class be equivalent?
...
I'm writing a simple string concatenation program.
The program works the way I have posted it. However, I first wrote it using the following code to find the end of the string:
while (*s++)
;
However, that method didn't work. The strings I passed to it weren't copied correctly. Specifically, I tried to copy "abc" to a char[] vari...
I have gotten used to using size_t in my C++ code by way of C due to a professor's insistence and I was curious if 'var' in C# is the same sort of thing?
...
Hi, i tried fopen in C, the second parameter is open mode. two modes "r" and "rb" tricks me a lot...it seems they r the same...sometimes it better to use "rb", so, why does "r" exist??
can expain it to me, more detailed or examples
thanx
...
I've been working on win32, c,c++ for a while. I code on visual studio. Most of the time I see system idle process uses more cpu utilization. Is there a way to allocate more processor cycles to my program to run it faster? I understand there might be limitations from i/o, in those cases this question doesn't make any sense.
OR
did i mis...
Hello,
I am working for a project at school regarding face recognition, based on a technique described by Viola and Jones 2001/2004.
I've read that the OpenCV has an implementation of this algorithm, and it works very good.
I was wondering if you have any advices regarding what techniques (pre-processing) to apply to the images befor...
I ve designed a win32 service in windows XP its working fine. but the problem i'm facing is that it's not working properly in windows 2000 platform. that is stopping the service restarting the service. is there any setting or need to change in code to be done.
...
In the man page for the system call write(2) -
ssize_t write(int fd, const void *buf, size_t count);
it says the following:
Return Value
On success, the number of bytes
written are returned (zero indicates
nothing was written). On error, -1 is
returned, and errno is set
appropriately. If count is zero and
the file ...
i would like to execute a batch file from a program (exe file). i usually create the batch file while program (exe file) execution. and will the execl("START","",NULL);
the function is calling the batch file, but unfortunately new command window is showing up as the execl function is process START and parses as “cmd.exe /k "
.
can you ...
I am trying to program using C to write binary data to a .bin file and just iterate through to write from 0000 to FFFF. I figured I would use fopen with a 'wb' tag and then be able to write binary data but I'm unsure how to iterate from 0000 to FFFF using C. Thanks for any help.
Here's my code now:
#include <stdio.h>
#include <stdlib.h...
void printLine(const wchar_t* str, ...)
{
// have to do something to make it work
wchar_t buffer[2048];
_snwprintf(buffer, 2047, ????);
// work with buffer
}
printLine(L"%d", 123);
I tried
va_list vl;
va_start(vl,str);
and things like this but I didn't find a solution.
...
I'm tasked to create a program which dynamically allocates memory for a structure.
normally we would use
x=malloc(sizeof(int)*y);
However, what do I use for a structure variable?
I don't think its possible to do
struct st x = malloc(sizeof(struct));
Could someone help me out?
Thanks!
...
I'm trying to get a fullscreen 8 bit depth framebuffer but I can't find any visual to work with. I want 8 bit truecolor, where 3 bits are red, 3 bits are green and 2 bits are blue. I'm using XF86 to go fullscreen.
// pass
int found = XMatchVisualInfo(l_display, l_screen, 24, TrueColor, &visual);
// all of these fail
found = XMatchVisu...
I need to create a structure inside a function (dynamically with malloc)
Then i need to be able to send it to my main, and use it there.
I have no problems creating it, I simply need help sending it to my main, and I'm also unsure of how to access it once I get it there.
struct retValue * fn() {
struct retValue
{
int number;
};
...