Hey all, I'm trying to find the numeric position of a character or number of characters in a string. I'm able to figure out how to see where character "a" is in the string "abcd" but if I put "abcda" it only prints out 0, meaning that it counts only the first instance. I want to find the last or rightmost occurence of this string. Her...
New to C, thanks a lot for help.
Is it possible to define an array in C without either specifying its size or initializing it.
For example, can I prompt a user to enter numbers and store them in an int array ? I won't know how many numbers they will enter beforehand.
The only way I can think of now is to define a max size, which is n...
I'm trying to run my server program but I keep getting this error:
ERROR on binding: Address already in use
int main(int argc, char *argv[]){
if (argc < 6){
printf("usage: stringSearcher <filename> <stringLength> <searchLength> <nChildren> <nThreads> <blockSize>\n");
exit(0);
}
char* fil...
Is this possible?
I want to place intel assembly code into a char buffer, and then execute that code from within a C program
If I placed the assembly code into a buffer, could I cast it into a function pointer and call that?
I am using GCC and linux
...
I'm working on getting set with Eclipse CDT for some embedded development and I'm having difficulty getting source level debugging working for static libraries.
I'm using my own Makefiles, so that is my first suspect right now, especially since gdb claims that no symbol table info is available for the functions with no source. When usi...
I wrote a test program thinking that the address of p1 will be less than p2, but when I compiled the code, the address of p2 turned out to be lower (p1 is 8 units larger than p2). I also heard rumors that 2 adjacent memory blocks will combine themselves automatically. Does that play any part in the following code?
void main(){
char...
I've managed to store the article into heap, but what should I do with the dictionary? I tried using strcpy(tempArticle[i], dictionary); but it didn't seem to work? would someone give me a hint as to what to do in the next step?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void spellCheck(char article[], char dictionar...
I am wondering why I can't compile an example from book. I simplify the example here to avoid posting example from a copyrighted book.
#include <stdio.h>
BYTE *data = "data";
int main()
{
printf("%s", data);
return 0;
}
When compile with g++, i get error,
error: invalid conversion from 'const char*' to 'BYTE*'
The progr...
This is a mad-hack, but I am trying to deliberately cause a segfault at a particular point in execution, so valgrind will give me a stack trace.
If there is a better way to do this please tell me, but I would still be curious to know how to deliberaly cause a segfault, and why my attempt didn't work.
This is my failed attempt:
long* p...
Hi.
I want to include the libavcodec in my Qt-project.
Should I do that with
#include <ffmpeg/libavcodec.h>
or with something more Qt, for example
QLibrary mylib("libavcodec");
And also a question to understand if I really got it: To use libavcodec, do I need to import the source-files or the .dll?
...
The projects I work on are organised into root folders (VOBS) as follows:
|--BUILD_FOLDER
| |-- BUILD_SCRIPTS
| |-- SOME_MORE_CODE
|
|--COMPONENT_A
|--COMPONENT_B
Because they are ClearCase VOBS there is no higher level root folder to place a CMakeLists.txt This setup doesn't seem to fit the CMake pattern...
Is this a show-stopper t...
How do I read an image in C so that I can have direct control over its pixels (like we do in MATLAB)?
I tried the old way:
FILE *fp;
fp = fopen("C:\\a.tif","r");
that just gives me the ascii form of the image file (I think).
How can I get pixel level control over the image and do some basic operations like say, inverting the image?
...
I need my program written in pure C to stop execution when stdin is closed.
There is indefinite work done in program main cycle, and there is no way I can use blocking checks (like getc()) there (no data is supposed to arrive on stdin - it just stays opened for unknown time).
I intend to use described functionality in realization of ne...
Just looking for how to programmatically add a watermark or some sort of overlay to video using cocoa. Not looking for a step by step ( although that would awesome ), but more or less looking for where I should start looking to learn how. Are there frameworks developed to work for this. Would like something native to cocoa or objectiv...
While I was working i came across a code which was written by somebody else.
i see a statement as ,
sprintf(o_params->o_file_name,
"%s_%s_%04.4d_%s_%s.ASC",
"OUTD", "RM", sequence_no, DateStamp_buf1, TimeStamp_buf1
);
In the above statement, I see %04.4d. Is this a correct format specifier?
The variable sequence_no ...
Suppose I want my C code to fetch the headline from a website, like www.example.com
How to do that?
Can I write a program in C to do this?
give me a start...
...
Hi,
i wonder if there is a easy way to convert my float array image to iplimage,
which can be handled by opencv. Of course i could create an empty iplimage with the same size and just copy ever pixel from my float array image to the emplty iplimage, but is there more elegant solution to this. Maybe a faster less memory consuming method,...
I need to implement a few commands of Linux shell for my homework - 5 or 6 of them, including ls. Do not know much about which parameters to implement for each of commands...
I planned to use C++, but when I asked my colleague for advice what language to choose - plain C or C++, he said that interpreter was not a program in traditional ...
Could anybody please tell me which is best guide/book/material for socket programming in C?
I am reading beej's guide for network programming but it just gives an overview.
Can you suggest any other books or guides?
...
I am trying to add iostream to the legacy code and thus want to sync those two libraries.
According to this article, I should use std::ios_base::sync_with_stdio.
Now, I wonder how it is used in practice (examples please), side-effects I should be aware of.
Thx
...