c

c / c++ disable access to files

Is it possible to disable access of some program to files completely? Because I don't want it to have any kind of access to files on system, is it possible to compile it so it doesn't have access to file stream or to run it someway it cant access files? ...

is there a function that lets me look at the next char?

is there a function in c that lets me look at the next char in an array? Also where could I find this information on my own, I tried Google and looking for existing threads on this site. I am trying to pull numbers from a line, and store those numbers. So I want to do something like if(c = a number and c "next character" is not a nu...

C simple array access comparison

int isEmpty(char x [1000]){ int i = 0; while( x[i] == " " || x[i] == "/t" || x[i] == ""){ i++; } if (i != 999) return 1; } return 0; } The errors I recieve: warning: comparison between pointer and integer warning: comparison with string literal results in unspecified behavior I realise my c...

Gtk+ and OpenGL bindings

Simple and short: What is the most advanced OpenGL binding for GTK+? I would prefer a widget which allows me to use it similar to QGLWidget. Note: I stumbled upon gtkglext, gtkglarea and clutter. I read the first two have shortcomings/ serious issues. ...

Using Visual Studio combined with Intel Fortran, how to solve using with different types of name-mangling

I have obtained program that is lovely mesh of fortran and c code. In order for this program to compile it requires a series of libraries that comes precompiled from software vendor. This included among others Intel MKL, MPICH2 etc. On linux everything works just fine. But on windows I am stuck: Using the command line, I can compile the...

packet travelling in layers

I want to know how a network packet travels through different layers i.e. from physical layer to presentation layer in Linux systems. I want very detailed article or book on this topic with codes in C. I tried to Google it but unable to find. Any other type of guidance is welcomed. Kindly help. Thanks in advance. ...

How can we change the background of the desktop via filing?

I wish to change the background of my computer by doing filing in C language but I dont have any idea how to proceed in this regard.Please guide me to the files i must open and what changes must i do to them ...

Modifying command line args so that they cannot be seen in ps output

Hi everyone, I have an executable that accepts certain command line arguments. Any user on the machine can find the arguments by doing a ps (Unix) or procexp (Windows). Some of these arguments are things like passwords. I know we should not be passing in passwords like that. Is there any way in code of the executable that I can change ...

Concept of register variables(datatype:register) in C language ?

hi, I just to want to get an idea about how the register variables are handled in C program executables. ie in which location(or register) it exactly get stored in case of an embedded system and in a X86 machine(C program executable in a desktop PC)? What about this view? (correct me if am wrong) Suppose we have declared/initialized o...

Swapping two string pointers

i have to char[] in C and i wanted to swap between them, by only swaping the pointer to the array and not one char at a time so i wrote this code: #include <stdio.h> void fastSwap (char **i, char **d) { char *t = *d; *d = *i; *i = t; } int main () { char num1[] = "012345678910"; char num2[] = "abcdefghujk"; fastS...

How to write a ANSI C user-defined function that returns a specific line from a text file?

How to write a ANSI C user-defined function that returns a specific line from a text file? char * ReadFromFile(const char * fileName, int line) { //.......... } ...

At what stage of compilation are reserved identifiers reserved?

Just a little curiosity at work, here. While working on something dangerous, I got to thinking about the implementations of various compilers and their associated standard libraries. Here's the progression of my thoughts: Some classes of identifiers are reserved for implementation use in C++ and C. A compiler must perform the stages of...

Efficent Cache usage in C

Hello people! I want to write code that best uses the cache memory of my system. For example, I have one large array(2kb size) that is frequently used in operations. For better execution speed, I want it to be loaded in chache memory so that It takes less time for processor to fetch it. How can I ensure this thing in C language? Any hel...

readline clash with child printf?

In Linux, readline() in an infinite loop repeatdly reads text\n. However, as soon as child processes start printing to the screen, readline no longer reads new lines. Even if I repeatdly press enter, readline() doesn't return. Anyone know what's wrong? Code sample as requested: char* input; int cpid; while(1) { input = readline("...

How can I have a solid understanding of c pointers?

How can I have a solid understanding of C pointers? How should I direct my way of thinking about pointers in C? ...

gcc switches - what do these do?

I am new with using gcc and so I have a couple of questions. What do the following switches accomplish: gcc -v -lm -lfftw3 code.c I know that lfftw3 is an .h file used with code.c but why is it part of the command? I couldn't find out what -lm does in my search. What does it do? I think I found out -v causes gcc to display program...

not enough variables to fit a sentinel

According to exec reference, calls to exec (or stack checking vararg functions in general) requires a (char*)NULL aka 0 at the end of the parameter list. GCC, however, is complaining about the following code char cmdFullPath[4096]; //yes this 4096 thing is bad coding practice ... execl(cmdFullPath, (char*)NULL); //warning: not enough ...

How do I build a game in C with actors programmed in Lua?

I want to build a strategy game using C and Lua. C++ is also an option. I would like to create an environment where a player can move around. In the same environment, other actors (programmed in Lua) should be able to move around. Their Lua code should control how they move. It sounds simple enough, but I wonder what would be a good de...

Should be there newSVuv intead newSVnv in perlxstut?

I'm just going through perlxstut and I found there newSVnv in EXAMPLE 5 and EXAMPLE 6 but I think that newSVuv should be more appropriate. Curiously newSVnv works too. What's going on? ...

embedded programming in C

Hi, I am a newbie as far as it comes to embedded systems programming. I have to write lots of simple C or C++ programs like atoi, itoa, oct_to_dec, etc., which would have been easy to write in normal C. But my hardware unit does not have the usual header functions and hence I cannot use standard library functions. :( Could someone hel...