Stack Overflow » Newest questions tagged C
367 FOLLOWERS
Stack Overflow is the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. This section is a place for discussing C++.
Stack Overflow » Newest questions tagged C
21m ago
What i want to do with the program is to create 3 child processes from one parent . Each child will have 2 pipes connecting to the parent so it can write to the parent and read from it. With this i want the children to communicate with each other trough the parent for example child 1 decides to send a message to child 3 it will first send to the parent then the parent will send it to child 3. To do that i need to make the read pipe ends non blocking. When no massage has been send it works fine but when i try to send something it still writes that pipe is full. My questions is what i am doing w ..read more
Stack Overflow » Newest questions tagged C
2h ago
Trying to code the laplace expansion as i'm learning it in college and i'm stuck when it comes to getting the minor matrix of a big matrix. This are always square matrices and the minor matrix is always 1 size less than the big matrix, such that: matrix = nxn => minor = (n-1)x(n-1).
In this part of the code I get the minor such that for an element 'a' of the first row of the matrix the minor consist of all the values that are NOT in the same row or column as element 'a':
float minor[matrixDimension-1][matrixDimension-1];
for (i = 0; i < matrixDimension; i++) {
for (j ..read more
Stack Overflow » Newest questions tagged C
2h ago
From this SO answer it is my understanding that the following C code is bad practice because declaring c as a char will make a char like 0xFF and the EOF constant indistinguishable.
char c;
while ((c = getchar()) != EOF) {
...
}
However in this SO answer detailing the type conversion process when two integral operands of different types are being operated on (in this case with !=), the two types are converted to a common type. Typically to the type with more bits.
Question 1: Why then if the char 0xFF was found in a file would it not be converted to type int, and then compared to EOF ..read more
Stack Overflow » Newest questions tagged C
2h ago
Trying to figure out how to implement a turn based combat system into my text based rpg. It should be a callable function that, when called, takes the players statistic variables (health, intelligence, etc) and the enemy's statistic variables. The enemies' variables will come from a structure, and there will be different structs for different enemies so the function needs to be able to support that. The function will run until either the enemy's health reaches 0 or the player's health reaches 0. If the latter happens, a gameover function will play, which exits the program. The player will atta ..read more
Stack Overflow » Newest questions tagged C
3h ago
I've been utilizing the C X DevAPI Connector and encountered an issue with the API.
The function 'mysqlx_collection_modify_set' should be capable of updating or creating the key name "_b_ke-y$fkæøåÆåø", but it is not performing any action when attempting to do so. However, it works as expected when the key name is something like "test".
I'm using it in this way:
mysqlx_collection_t *collection_ = mysqlx_get_collection(schema, collection, 0);
mysqlx_stmt_t *stmt2 = mysqlx_collection_modify_new(collection_);
mysqlx_set_modify_set(stmt2, "_b_ke-y$fkæøåÆåø", PARAM_EXPR("{\"username\":\"test ..read more
Stack Overflow » Newest questions tagged C
3h ago
I am trying to do a Process Injection in C with the windws api (windows.h) and with tlhelp32.h. But I can not perform it. First of all I get the process and I make a comparison to know if the process I want to inject is executing but when I do the comparison I get an error saying that the types are wrong:
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
Process32First(snapshot, &pe32);
do {
if(wcscmp(pe32.szExeFile, L"mspaint.exe")==0) {
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.t ..read more
Stack Overflow » Newest questions tagged C
3h ago
I am a beginner and I have problems with Makefile for my c project.
In my project folder I have 2 folders: src and includes. And I want to make a Makefile to compile and run the codes, but I never tried Makefile and didn't found any solution. Scan you make me the Makefile that can adjust depending on the number of files?and can you please explain how to use Makefiles ..read more
Stack Overflow » Newest questions tagged C
4h ago
I made a gesture detection algorithm using keras vgg model. And I want to call a function, which executes the entire algorithm through a C application. This was the code created so far:
#main.c:
#include <Python.h>
#include <stdlib.h>
#include <stdio.h> // Adding required inclusion for printf
int main() {
// Initialize the Python interpreter
Py_Initialize();
// Import the Python module that contains our functions
PyObject *pModule = PyImport_ImportModule("yolo_vgg_integration");
// Checks if the import was successful
if (pModule != NULL ..read more
Stack Overflow » Newest questions tagged C
4h ago
I am working on a C program to interpret chemical formulae that may include multiple levels of parentheses, and I am facing difficulties with correctly interpreting these formulae. The goal is to associate each atom with a variable based on a provided formula.
I am using the code below to process chemical formulae with varying levels of complexity. For example, for the formula {"2F2(SO4)3", 'A'}, the processing is correct; however, for {"Na(H2(SO3)4)5", 'B'}, the interpretation is incorrect. The expected result for {"Na(H2(SO3)4)5", 'B'} should be Na + H10 + S20 + O60, but it is resulting in N ..read more
Stack Overflow » Newest questions tagged C
5h ago
I am trying to implement ecb encryption/decryption using OpenSSL. At present all the setup process seems to return success codes however when it comes to the final decryption it fails.
I have checked the input and key size to make sure they are both divisible by 16 and I have checked a number of other threads and this man page to try and find examples of how to do this properly.
This question seems to have the exact same problem however implementing the suggestions did not rectify the issue.
At present the function is returning 0 which indicates decryption failed however I can not identify wha ..read more