Debug assertation failed when trying to use fwprintf
Stack Overflow » C#
by Gaetano
1d ago
I wrote a program that converts a BMP into ASCII and it worked fine, but I tried to modify it so it writes Unicode characters. Now, when I try to write to the file, it gives me this debug assertation fail (Visual Studio 2022): Debug Assertation failed! Program: ...ocuments\dev\projects\ImageToASCII\x64\Debug\ImageToASCII.exe File: minkernel\crts\ucrt\inc\corecrt_internal_stdio.h Line: 495 Expression: ((_Stream.is_string_backed()) || (fn = _fileno(_Stream.public_stream()), ((_textmode_safe(fn) == __crt_lowio_text_mode::ansi) && !_tm_unicode_save(fn)))) I don't know what this means ..read more
Visit website
Calling c function from Rust with Hebrew characters
Stack Overflow » C#
by Jake
1d ago
I have the following c library: #include <cstdio> extern "C" void print_name(const char *name) { printf("C name %s\n", name); } and I have the following Rust code which call it with Hebrew characters: extern "C" { fn print_name(name: *const ::std::os::raw::c_char); } fn main() { let name = "עברית"; println!("Rust name: {}", name); let c_name = std::ffi::CString::new(name).unwrap(); unsafe { print_name(c_name.as_ptr()); } } I compile it with: "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl" /c ..read more
Visit website
How can I write an array with a function in c
Stack Overflow » C#
by gonza
1d ago
i want to modify the array declared at the beginning of the script, with a function. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <string.h> void b (); char a[10][10]; int main(void) { b(); printf("%s\n",a[0]); printf("%s\n",a[1]); } void b () { strcpy(a[0],"HOLA"); strcpy(a[1],"ADIOS"); } I tried to move the array in differents parts of the script but it didn´t work. I think the content of the array disappears when i exit the function ..read more
Visit website
Trying to pass a "pointer to a struct Data" to the signal handler using sigqueue function from one process to another, using the siginfo_t struct
Stack Overflow » C#
by Hamza Awashra
1d ago
I'm currrently learning about signals in C language under Linux operating system. I have a parent process that wants to send a struct of integer values called struct Data to a child process that it forked - using the siginfo_t struct that is a parameter to the signal handler when we define a signal handler using sigcation: void handler(int, siginfo_t*, void*) the parent process defines a union sigval, and sets the sival_ptr field in the union to (void*) data where data is a struct Data that contains two integers. The parent then uses sigqueue(child_pid, SIGUSR1, my_sigval) The child process us ..read more
Visit website
Building an Azure IoT SDK C application with linking issues
Stack Overflow » C#
by Engineer999
1d ago
I have built the azure-iot-sdk-c on Debian. All the samples build and run as expected. I am now trying to create a portable application with my own Makefile, with all the required Azure libraries inside one libs folder. I am having issues linking to the libraries. My application should simply provision itself on the Azure IoT hub and then send messages. I have taken the sample code directly from the prov_dev_client_sample into my own source file and my Makefile looks like this : CC = gcc CFLAGS = -g -Wall INC = -I./inc -I./inc/c-utility/inc -I./inc/iothub_client/inc -I./inc/umqtt/inc -I./inc ..read more
Visit website
Libproc only showing one mapped region
Stack Overflow » C#
by Daniel Walker
1d ago
I've got this MRE compiled on macOS: #include <stdio.h> #include <unistd.h> #include <libproc.h> int main() { int ret, num; struct proc_regionwithpathinfo info[20]; ret = proc_pidinfo(getpid(), PROC_PIDREGIONPATHINFO, 0, &info, sizeof(info)); if (ret < 0) { perror("proc_pidinfo"); return 1; } num = ret / sizeof(info[0]); for (int k = 0; k < num; k++) { struct proc_regionwithpathinfo *region = &info[k]; printf("0x%016llx - 0x%016llx\n", region->prp_prinfo.pri_address, region->p ..read more
Visit website
CAPL Script in CAnoe Report generation takes too long
Stack Overflow » C#
by Jayasurya
1d ago
I have written a CAPL script for a testcase which will execute for 65535 times (0xFFFF), i have used for loop to do that. the execution is working fine , but it takes around 14-15 hours of time to generate the report, what is the problem here? the testcase name and title is provided by xml file. I have written the CAPL testcase to perform some simple comparison with the values from 0 - 0xFFFF and return teststeppass, if the condition is met else teststepfail will happen, this testcase is executed for 65535 times, since the for loop is used to achieve the condition. The report generation is tak ..read more
Visit website
Implementing a new feature in Linux Kernel and benchmarking [closed]
Stack Overflow » C#
by Hokkyokusei
1d ago
As part of our OS project, we need to add a new feature to Linux. Most probably this involves meddling with the kernel. We have never worked with Linux and have less than one month to implement the idea. Due to time constraints, I need to fast-forward the process by understanding how to get started. The basic idea consists of the following: - We need to create a process (say p1) having two child processes (say cp1 and cp2). The two child processes will perform several memory operations where it will access and modify its data (just a contiguous array variable in the c code of the process). We ..read more
Visit website
Transitioning a 1D Decomposed Cellular Automaton to a 2D Decomposed Cellular Automaton is causing discrepancies in results
Stack Overflow » C#
by RustyRyan
1d ago
I have a 1D Decomposed Cellular Automaton problem which is producing the right results as the serial problem, I'm now trying to transfer it to a 2D Decomposed Solution using MPI Cartesian Topology and the results are not matching with the 1D solution Decomposed means breaking the problem into smaller parts. In a scenario with 4 processes, the code breaks it across a single dimension. If L is 100, rows would be L/4, columns still L but arranged in 2D, with rows and columns each divided by the square root of 4 for even spreading across segments. The code is long, but this is a minimal reproducib ..read more
Visit website
How can I write a hexadecimal viewer in C?
Stack Overflow » C#
by Miguel Salazar
1d ago
I'm working on a code for a homework. Our teacher gave us this example. We gotta write a code about a hexadecimal viewer. This one must write down lines, edit, map characters and edit. #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <ctype.h> #include <string.h> #include <curses.h> #include <sys/stat.h> #include <sys/mman.h> /* Variable global para mejor legibilidad */ int fd; // Archivo a leer char *hazLinea(char *base, int dir) { char linea[100]; // La linea es mas pequeña int o=0 ..read more
Visit website

Follow Stack Overflow » C# on FeedSpot

Continue with Google
Continue with Apple
OR