custom FILE type in C/C++
Is it possible in C/C++ to create my own custom stream of type FILE (stdio.h) that can be used with fputs() for example ? ...
Is it possible in C/C++ to create my own custom stream of type FILE (stdio.h) that can be used with fputs() for example ? ...
Hi, I have written a small Pro *C/C++ application [ multi-threaded, daemon ] where, i used Pro *c to fetch some DB records and then call C++ function to generate XML files, which are sent through socket to third party. The problem is that, when the c++ function is called, it is generating the xml file properly, but ending up with Sig 1...
Possible Duplicates: C/C++: Detecting superfluous #includes? How should I detect unnecessary #include files in a large C++ project? Hi, I've been following numerous discussions about how to reduce the build time for C/C++ projects. Usually, a good optimization is to get rid of #include statements by using forward declaration...
Hello, I am using the code below char call[64] = {'\0'} /* clean buffer */ strncpy(call, info.called, sizeof(call)); I always use the sizeof for the destination for protecting a overflow, incase source is greater than the destination. This way I can prevent a buffer overflow as it will only copy as much as the destination can handle....
I'm trying to find a basic reverse shell example in C or C++, Basically I want to write a code to simulate the following netcat scenario: Listener: ------------------ C:\nc -L -p 80 Client -------------- C:\nc 127.0.0.1 80 -e cmd.exe For whom doesn't speak netcat: This means I want to redirect stdin and stdout from cmd.exe to netwo...
How can I pass any number of arguments in User define function in C?what is the prototype of that function?It is similar to printf which can accept any number of arguments. ...
I'm trying to change the behaviour of some functions in C with help of the preprocessor; and also add optional parameters that can be set on or off... The basic pattern for the optional parameters is easy: #ifdef OPT_PARAM #define my_func(a, b, opt) _my_func(a, b, opt) #else #define my_func(a, b, opt) _my_func(a, b) #endif /*the r...
In our project which supports multiplatform (Linux, Solaris, Windows) and coded in c,c++ , we are using ONC Rpc for IPC. Recently there is a requirement to have an application server to work on two different programs no. I have tried following to test. Created a multithread application Within that creted two worker threads I...
I need to convert a C/C++ double to a 64 bit two's complement, where the Radix point is at bit number 19 (inclusive). This means that for the format I want to convert to 0x0000 0000 0010 0000 is the number 1 0xFFFF FFFF FFF0 0000 is the number -1 0x0000 0000 0000 0001 is 0.95 x 10^-6 0xFFFF FFFF FFFF FFFF is -0.95 x 10^-6 So far ...
I have a DWORD value that in Hex might look like: DWORD Val = 0xFF01091A How can I read each byte? What I mean is, how can I read FF, 01, 09 and 1A? Thanks! ...
I'm trying to read a file into a buffer in blocks of size BLOCK_SIZE (currently equal to 1000 unsigned chars). My code first finds the number of blocks it will have to read in order to read the entire file (usually 2-4), then iterates through a for loop reading the file (ignore the "+17+filenamesize" stuff, that is all needed for later i...
Is there some sort of "Learning C for developers of other languages" book or tutorial available? I am currently trying to learn C (not C++, maybe later) and even though I had some experience with it (had it in school writing DOS Applications using Borland C...), I don't know much about the standard library or about the "architecture". ...
As I work on a c++ application, I realize I am making a lot of classes and functions that could be used in other projects. So I'd like to put all this code in a separate net beans project that can be "included" into other projects. (with code completion etc) I've tried creating a new "static library" project, then I added the project to...
I have a problem with stdout and stdin .when i store data by using stdout i cant getback the same data using stdin . so please help me how can i solve my problem. Ram ...
This is the code how can be solve struct Tool { FILE *in; FILE *out; }; int main() { Tool *t; t->in=stdin; t->out=stdout; Tool_sendcmd(Tool *tool,"SET VARIABLE value %d",3); } void AGITool_sendcmd_nav(TOOLS *tool,char *command, ...) { va_list ap; char buffer[1024],*str; va_start(ap,command); ...
I'm writing an application in C that can be extended at runtime by means of modules / shared objects / DLLs. Those modules may use the API of the existing program but may also provide new functions for use in later loaded modules, so there is the possibility for modules to have dependencies on each other. My current approach under Linux...
Please tell me related websites for that code. ...
I have a piece of code that presents an interesting question (in my opinion). /*power.c raises numbers to integer powers*/ #include <stdio.h> double power(double n, int p); int main(void) { double x, xpow; /*x is the orginal number and xpow is the result*/ int exp;/*exp is the exponent that x is being raised to */ printf(...
I know very little about VS, and was surprised when my linux code did not compile on windows. The problem seams from the lack of <complex.h> in VS. My question is this: do people re-implement in their Windows applications, or is there a public domain version. ...
I want to store lines of strings dynamically using C language. for e.g sadasdasda5245sdf fadfa6456 fasdf90-70=790 the number of such lines and the length of each line can be anything.Is there any way to store the whole thing dynamically. ...