Questions for c


how to read contents of a structure using fread() in c

I have the following code where I am trying to read the content of a file and display it and also write to another file. My problem is the content i get on the screen is completely different from ...

Replacing Characters in C

This is part of a lab assignment

Why is forking slowing down my application

My application takes a checkpoint every few 100 milliseconds by using the fork system call. However, I notice that my application slows down significantly when using checkpointing (forking). I test...

I need help converting my driver user interface code

I have a custom driver I have written.

How to dynamically load often re-generated c code quickly?

I want to be able to generate C code dynamically and re-load it quickly into my running C program.

Problem with Arduino and pySerial

I got a problem. I recently bought an Arduino Uno board. I tried to make something funny like controlling an input from my computer. I used Python with pySerial and the program is the following:

How to add a question mark to the end of a line?

I want to check to see if the user added a ? to the end of the buffer. If not, I want the program to add one automatically. This is what I have so far. I dont know what to do next.

Catch “The program stopped working” on Vista

On Vista, I got a problem with the application crash handler. Basically, if something unexpected occurs which cannot be captured by SEH, I get this pop-up window with "The application stopped worki...

How many asm-instructions per C-instruction?

I realize that this question is impossible to answer absolutely, but I'm only after ballpark figures:

Linux-MIPS syscall-saved registers?

Which registers are saved across syscalls (not function calls, the actual round-trip to kernelspace via the syscall instruction) on Linux/MIPS?

Applying malloc

guys... can u help me apply malloc in my code... here's my code:

Pushing data from a structure into a stack in C

The task of the program is to push all the data from a structure into a stack, using memcpy.

Which is the best way to update a record of a file in c?

I have a struct similar to the usually used student struct and I am storing multiple records in a file. I want to be able to update the fields inside the file but I am not sure which way is the bes...

How do I zip a directory or multple files with zlib, using C/C++?

I did search for this topic, but I didn't find any relevant clue for this.

Commonly Accepted Variable Name Formatting - C/C++

I realize that this can be a matter of preference, but I have noticed that variables names in a lot of code samples I've seen have a prefix of g_, s_, m_, or just _. Is this a commonly accepted

PCSC reader emulator

I need an software emulator PC/SC reader for Linux, but can't find.

How do I tell valgrind to memcheck forked processes?

I have a process x that I want to check for leaks with valgrind. The problem is that x is run by y, and y in turn is run by z. I can't run x standalone because y and z setup the environment for x...

readability of long int v. long

Which is more clear to someone reading code? "long" or "long int". "long int" is more descriptive, but "long" is more succinct.

Erasing a Char

Okay i am working on someone elses code. They do alot of this:

Segfault on very simple source

I'm trying to write a simple script using the FreeType library. The segfault is occurring during execution of the FT_Set_Pixel_Sizes method, though I'm using it correctly. Any help would be great. ...

Embedded Parser Memory Use XML vs JSON vs?

I have an embedded weberver which is currently used to administer various bits of hardware over a network.

Shifting elements in an array in C — pointer-based

So I'm trying to learn C right now, and I have two functions: one that shifts elements in an array:

Compare user input with text file in C

I need to have a user input a word then compare the word with a text file to see if it is correct. The user has 3 attempts to enter the word before the program terminates. My issue is reading the w...

trees data structure implementation in c

this code was perfectly working when i was using integers now

Disabling WinAPI

I'm building a game where each player must program his bot. The key idea is that the player will program in C (or C++, or whatever compatible language), build a DLL and send this DLL to the server,...

inet_aton() returning success for invalid ip addresses?

I am looking for some function to verify that if given string is a valid ipv4 address,

Reading file into char array in C: Or how to dynamically allocate an array?

Using Linux system calls open and read. The read call accepts 3 parameters

What does it mean when string 1 is “less than” string 2 in C?

In the documentation of the strncmp(const char *s1, const char *s2, size_t n) function of the XC8 compiler, I read:

How the function do_raw_spin_lock is implemented in linux

While debugging panic issue realted to spinlock, I came across this definition of spinlock in

OpenCV - is there anething like delete text?

I need such thing because it seems to me that when I do

Is there a compiler or IDE for C on Windows that's regarded as an industry standard?

Taking advice from this post, I purchased a copy of 'The C Programming Language' and am happily reading my way through.

How do I create a sqllite3 in-memory database?

One of the appropriate uses for sqlite3 is "in-memory databases". This sounds like a really useful tool for my C++ applications. Does anyone have an example of how this is done in C or C++? I'm

Can't pass pointers to scanf(“%s”,ptr);

So I commented out the scanf part (and just initialized it with my own string), why does it crash if I use scanf? I believe the actual arguments I've put in scanf(); are correct.

Sonar : any feedback?

I am currently doing a little study over Sonar and (why not) other tools to manage code quality.

QDevelop problem debugging location pointer disappears

I am having a problem with QDevelop version 0.27. When I debug the location pointer jumps around without the IDE following it and showing me where it went. I have to manually click through the source

Compiling 64 bit DLL for JNI

I want to include a C library in my Java project via JNI. I wrote the necessary JNI wrapper code and I have compiled and tested it in a Linux environment using gcc and make. Now I need to compile t...

Reposition rectangle after zooming

I have a rectangle defined by R1:x1,y1-x2,y2 and after applying zoom, I get the

How to search common passwords from two given files of size 20GB?

i have two files of size 20GB. i have to remove common passwords from either of one file.

UTF-8 string size in bytes

I need to determine the length of UTF-8 string in bytes in C. How to do it correctly? As I know, in UTF-8 terminal symbol has 1-byte size. Can I use strlen function for this?

Testing embedded spaces in c

I want to create a function in C programming, which will test for the embedded spaces in C.

Handling multiple recv() calls and all possible scenarios

I am fairly new to C and writing a TCP server, and was wondering how to handle recv()'s from a client who will send commands that the server will respond to. For the sake of this question, let's ju...

Parent and Child address space confusion

Its obvious that we have a code block like

CreateFileMapping() fails for Volume

I'm having problem with mapping part of volume to memory. Volume is opened successfully, I can read from it, but CreateFileMapping() fails. GetLastError() returns 87, which has following meaning: "...

information on TAP and TDD for 'C'

I am precisely looking for the info like ,

Typedef struct pointer to function (C)

I am trying to pass a typedef struct pointer to a function and the compiler is complaining with this error message: error: unknown type name ‘RootP’. Here is the code...

Multi Pointer X (MPX) support

I'm wondering how multiple pointers should/could be handled by a high level application.

ld: library not found for -lplot

I am new here. I recently installed plotutils-dev on my mac using fink, but when I try to compile a little program I have by doing

How would you implement the pilloried function in the Daily WTF?

The Daily WTF for 2008-11-28 pillories the following code:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.