Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [c]

C is a general-purpose programming language used for system programming (OS and embedded), libraries, games, and cross-platform. This tag should be used with general questions concerning the C language, as defined in the ISO 9899 standard (the latest version, 9899:2018, unless otherwise specified — also tag version-specific requests with c89, c99, c11, etc.). C is distinct from C++, and it should not be combined with the C++ tag without a specific reason.

1 vote
0 answers
21 views

Broken pipe error with Ports between Elixir and C [closed]

I am attempting to write a program in Elixir that connects to a C program via Port and erl_interface. I got the C code up and running and managed to send data through the port as well as decode and ...
2 votes
3 answers
69 views

Read is blocked by getc

For the following code: #include <unistd.h> #include <stdio.h> int main() { char buf[6]; printf("%c\n", (char)getc(stdin)); int ret = read(STDIN_FILENO, buf, 5); ...
661 votes
10 answers
93k views

Undefined, unspecified and implementation-defined behavior

What is undefined behavior (UB) in C and C++? What about unspecified behavior and implementation-defined behavior? What is the difference between them?
0 votes
1 answer
102 views

Reduce an Image in C

Hello fellow programmers. I'm new to the forum so please bear with me. What I am trying to achieve is taking a loaded image from file(e.g. background wallpaper image 4000x2250) and scale it down to ...
0 votes
0 answers
13 views

K&R recommends the use of int when reading character using getchar()? [duplicate]

The problem is distinguishing the end of the input from valid data. The solution is that getchar returns a distinctive value when there is no more input, a value that cannot be confused with any real ...
0 votes
0 answers
64 views

How do I properly call OpenGL 3.3 functions in Fortran?

For some reason, I am trying to run OpenGL 3.3 in Fortran. I'm having trouble calling glGenBuffers(). When trying to compile a program with the glGenBuffers function, the lnk2019 error occurs. The ...
-1 votes
1 answer
21 views

Populating two arrays from a CSV file with each row containing two words separated by a semicolon

How could I fix my code that populates two separate arrays from a CSV file that contains words separated by semicolons in C? My CSV file looks something like this: to meet/encounter;begegnen to care ...
2 votes
1 answer
11k views

File transfer using RPC(any type of file)

I want to construct a RPC Program to transfer any type of files. But I am getting segmentation fault after running the client:such as ./file_client localhost >get /home/ab/1.txt >put /home/1....
1 vote
1 answer
79 views

C serial communication, Why does read() lose some data bytes at high baud rates (e.g., B921600)?

Question: I am implementing a C program to communicate between two serial ports on the same machine. The setup involves two serial ports connected via a Null Modem adapter, and I am experiencing an ...
0 votes
1 answer
58 views

Weird timings when measuring the perfomance of binary search [closed]

Okay, so what is happening here puzzled me for 2 days. Basically, as an activity I was measuring how much time some algorthim takes to execute in its worse, average, and best cases. Until now, I got ...
0 votes
0 answers
22 views

Problem With Adding SFML 2.6.1 To Dev C++ (Linker Error)

I'm trying to add SFML 2.6.1 to Dev C++ (I use Windows 7). I added lib and include to Libraries and C++ Includes in Compiler Options; and added "-lsfml-graphics -lsfml-window -lsfml-system" ...
18 votes
6 answers
26k views

How can I prevent scanf() to wait forever for an input character?

I want to fulfill the following things in a console application: If user inputs a character, the application will do the corresponding task. For example, if user inputs 1, the program will do task 1, ...
0 votes
1 answer
272 views

Trouble building git-credential-libsecret: unknown type name ‘SecretService’

I'm trying to compile the git-credential-libsecret.c in /usr/share/doc/git/contrib/credential/libsecret by running sudo make on the Makefile there. However, this fails with the following output: gcc ...
0 votes
1 answer
27 views

problem with cs50 p-set3 runoff (print winner funtion)

so this is a problem from CS50 Week 3 runoff, when I am running this code I am getting the following error, I cant understand why? I don't find any problem with the code, so need help from more ...
2 votes
1 answer
31 views

LNK2019 unresolved external symbol in function defined in static library

I am trying to compile a driver through the use of cl.exe on Windows 10. It is written in pure C. I am using the Enterprise Windows Driver Kit to provide source files and compiling for X86. I ...

15 30 50 per page
1
2 3 4 5
27044