logo
down
shadow

C QUESTIONS

printf is not giving output when using system
printf is not giving output when using system
With these it helps It might just be that stdout isn't getting flushed - often stdout is linebuffered when connected to a console. Try either
TAG : c
Date : October 27 2020, 03:37 PM , By : Aqib
Running a particular c file in linux
Running a particular c file in linux
will help you You'll have to use wine or mono to run it, since it's not a Linux executable. Run file against it to be sure.
TAG : c
Date : October 27 2020, 03:37 PM , By : Cecilia Coxe
C error expected specifier-qualifier-list before ‘time_t’
C error expected specifier-qualifier-list before ‘time_t’
This might help you I got the error , Have you included ?
TAG : c
Date : October 27 2020, 03:37 PM , By : user3847931
How to format integer correctly in c?
How to format integer correctly in c?
may help you . Once you've tokenized the string, the last two tokens should be parsed with atoi then you'll have two integers. Those can be printed with sprintf(%02d, myInt).
TAG : c
Date : October 27 2020, 03:37 PM , By : Buttyx
Dynamic relocation of code section
Dynamic relocation of code section
may help you . Yes dynamic relocation is definitely possible. However, you have to make sure that the code is completely self-contained, or that it accesses globals/external functions by absolute references. If your code can be completely position in
TAG : c
Date : October 26 2020, 11:52 AM , By : user3848156
Efficiently Traverse Directory Tree with opendir(), readdir() and closedir()
Efficiently Traverse Directory Tree with opendir(), readdir() and closedir()
wish help you to fix your issue The C routines opendir(), readdir() and closedir() provide a way for me to traverse a directory structure. However, each dirent structure returned by readdir() does not seem to provide a useful way for me to obtain the
TAG : c
Date : October 26 2020, 11:52 AM , By : Akash
How am I able to access a static variable from another file?
How am I able to access a static variable from another file?
hop of those help? You have included one file into another - very bad practice. From C compiler point of view, both files form one translation unit, because C preprocessor inserts the content of a.c into b.c.In case of two separate translation units,
TAG : c
Date : October 26 2020, 11:52 AM , By : user3848044
srandom( time( NULL ) )
srandom( time( NULL ) )
Hope that helps May I know the meaning or even how to read this:
TAG : c
Date : October 26 2020, 11:52 AM , By : ruby_random
Looping threads accessing pthread mutex
Looping threads accessing pthread mutex
To fix this issue There are number of issues with the code as posted: Thread function allocates memory but never releases it. You hold the mutex over blocking socket read - it's never a good idea. Mutex should protect resource shared between threads
TAG : c
Date : October 25 2020, 07:29 PM , By : Eclipse Moon
sYSMALLOc: Assertion failed - any ideas how to debug effectively?
sYSMALLOc: Assertion failed - any ideas how to debug effectively?
Any of those help This is almost certainly due to a heap corruption bug in your code (writing just before or just after an allocated block).Since you are apparently on Linux, the tool to use here is Valgrind. It should point you straight at the probl
TAG : c
Date : October 25 2020, 07:29 PM , By : sumanth
Auto generate header files for a C source file in an IDE
Auto generate header files for a C source file in an IDE
will be helpful for those in need Eclipse CDT allows you to write a prototype in the header file, and automatically add it to the C file.Instructions
TAG : c
Date : October 25 2020, 12:12 PM , By : Kara Kim
printf and ++ operator
printf and ++ operator
To fix the issue you can do Nothing goes "from right to left" in function argument evaluation. When function arguments are evaluated, the order of evaluation is unspecified and there are no sequence points between evaluating separate arguments. This
TAG : c
Date : October 25 2020, 12:12 PM , By : user3848502
feeding a mouse driver alternate data in linux
feeding a mouse driver alternate data in linux
To fix the issue you can do That depends on if the mouse driver you've modified is in userspace or kernelspace.If it's userspace, you could use a UNIX-domain socket as your control channel. If it's kernelspace, you could use a sysfs entry.
TAG : c
Date : October 25 2020, 12:12 AM , By : Iszak Bryan
Random int 1-255 to character in C
Random int 1-255 to character in C
This might help you A char in C can only take values from CHAR_MIN to CHAR_MAX. If char is signed, CHAR_MAX may be less than 255 (for example, a common value is 127). If char is unsigned, CHAR_MAX has to be at least 255.Assuming your char is unsigned
TAG : c
Date : October 23 2020, 11:12 PM , By : Marcin Jeleński
Problems with File I/o when porting old 'C' libraries from 32-bit to 64-bit
Problems with File I/o when porting old 'C' libraries from 32-bit to 64-bit
Hope that helps I have really old 'c' code that uses read to read a binary file. Here is a sample: , Use size_t, not uint.
TAG : c
Date : October 23 2020, 11:12 PM , By : user3849028
Static / global variables in shared library in C language
Static / global variables in shared library in C language
fixed the issue. Will look into that further , will these processes share the global variables
TAG : c
Date : October 23 2020, 03:00 PM , By : simi raj
Is there a tool to list global variables used and output by a C function?
Is there a tool to list global variables used and output by a C function?
Hope that helps Our DMS Software Reengineering Toolkit is a customizable program analysis tool with a production quality C Front End.It parses C, builds ASTs and symbol tables, provides control and data flow analysis, and constructs global call graph
TAG : c
Date : October 23 2020, 11:12 AM , By : Paigan
functions returning char pointer
functions returning char pointer
like below fixes the issue No, it is undefined behaviour. It just happens to work in your case, but may stop working at any time.
TAG : c
Date : October 22 2020, 11:12 AM , By : 2makeitbetter
How many elements are full in a C array
How many elements are full in a C array
Does that help In a C array, any element is an object. It's not like in Java where you have references that first have to be assigned to point to objects. Anything in C behaves like a primitive type in Java. If you have an array of pointers in C, you
TAG : c
Date : October 21 2020, 11:12 PM , By : GustMarcOliv
Resources for writing kernel in C
Resources for writing kernel in C
it fixes the issue The tutorials at osdev.org should get you started. They even have a page for getting started. Writing an OS is not for the faint of heart. Good luck!!
TAG : c
Date : October 21 2020, 11:12 PM , By : firefist.wei
OpenGL: How do I avoid rounding errors when specifying UV co-ordinates
OpenGL: How do I avoid rounding errors when specifying UV co-ordinates
I think the issue was by ths following , Your issue is most likely not coming from rounding errors, but a misunderstanding on how OpenGL maps texels to pixels. If you notice off-by-one errors, it's probably because your UVs, your vertex positions or
TAG : c
Date : October 21 2020, 11:12 PM , By : tim gavin
Basic skeleton for a C OpenGL program on OSX
Basic skeleton for a C OpenGL program on OSX
this one helps. As far as I can tell, the NeHe tutorials are specifically for windows and are great for higher level stuff. However, when it comes to the basics, They can become overcomplicated. So here is a simple skeletal program for rendering a tr
TAG : c
Date : October 21 2020, 11:12 AM , By : Ghulam Mustafa
Float versus integer data type calculation issues in C
Float versus integer data type calculation issues in C
To fix the issue you can do Are you compiling for an embedded platform?Maybe your default int is just 2 Byte wide, in which case 12 * 20000 would overflow.
TAG : c
Date : October 20 2020, 11:12 PM , By : Paullinha Lopes
What have you used sysv/posix message queues for?
What have you used sysv/posix message queues for?
Hope this helps I had a series of commands that needed to be executed in order, but the main program flow did not depend on their completion so I queued them up and passed them to another process via a System V message queue to be executed independen
TAG : c
Date : October 20 2020, 11:12 PM , By : salokcin
Recursive harmonic function returns NaN
Recursive harmonic function returns NaN
I hope this helps . I have written the following sample code to find the harmonic value of N. (1+1/2+1/3+...1/N). Read the comments in the code written in BOLD and help me to find why is this happening. , I think you want to do:
TAG : c
Date : October 20 2020, 11:12 AM , By : rommelst
How to fix "unable to open stdio.h in Turbo C" error?
How to fix "unable to open stdio.h in Turbo C" error?
With these it helps If you have problems like that, first of all your TC folder put in to the C:..drive. after completing installation open turbo c blue screen. there is a OPTIONS > Directories ..in that you can see for option to set up path.. includ
TAG : c
Date : October 20 2020, 11:12 AM , By : MozendaTraining
C programming structure passed as cast to char *?
C programming structure passed as cast to char *?
Does that help Hysterical Raisens Casting buffers to char * is a legacy code pattern that one sees frequently. It has been used so often that it is still typed in today, long after it ceased to be necessary.
TAG : c
Date : October 19 2020, 11:12 PM , By : Ashisa Behera
Do I need to #include <omp.h> in my C/C++ sources?
Do I need to #include <omp.h> in my C/C++ sources?
hop of those help? You only need it to call OMP APIs. If all you need are pragmas you don't need to include it.
TAG : c
Date : October 19 2020, 11:12 PM , By : user3850489
Find original owning process of a Linux socket
Find original owning process of a Linux socket
Does that help You can use netstat for this. You should look in the columns 'Local Address' and 'PID/Program name'.
TAG : c
Date : October 19 2020, 11:12 PM , By : user3850485
How can I send e-mail in C?
How can I send e-mail in C?
it helps some times I'm just wondering how can I send email using C? I Googled it a little bit, but could not find anything proper. , On Unix like systems you can use system and sendmail as follows:
TAG : c
Date : October 19 2020, 11:12 AM , By : Łukasz Sz
How is the lagged fibonacci generator random?
How is the lagged fibonacci generator random?
like below fixes the issue To be precise, the lagged Fibonacci is a pseudo-random number generator. It's not true random, but it's much better than, say, the more commonly used linear congruential generator (the standard generator for C++, Java, etc)
TAG : c
Date : October 19 2020, 11:12 AM , By : user3850607
Trouble with dangling pointers and character arrays in C
Trouble with dangling pointers and character arrays in C
With these it helps , There are two issues with your program.First, when you say:
TAG : c
Date : October 19 2020, 11:12 AM , By : user7555
Trying to compile with cl.exe
Trying to compile with cl.exe
I wish this helpful for you Open a Visual Studio command prompt window that automatically setups the correct path and other settings for you. If you cannot do that, here are instructions on doing it manually: http://msdn.microsoft.com/en-us/library/f
TAG : c
Date : October 19 2020, 11:12 AM , By : M Sana Ullah
C code compilation failure
C code compilation failure
I wish did fix the issue. Backticks aren't how you run shell commands in a Makefile. Your CFLAGS and LDFLAGS lines should probably look like
TAG : c
Date : October 18 2020, 11:12 PM , By : user3850866
Gtk Draw Bitmap
Gtk Draw Bitmap
I think the issue was by ths following , Cairo does not have the brush concept: it is a (relatively) low level graphic library, not a full-fledged image manipulation program. This snippet gives the idea on how to include images.
TAG : c
Date : October 18 2020, 11:12 PM , By : Fair View
booting from a disk/cd/usb
booting from a disk/cd/usb
hope this fix your issue A bootloader must be 512 bytes. No less no more. And it must end with the standard PC boot signature: 0xAA55.Also note a PC boots in 16 bits mode. You need to load your kernel or secondstage bootloader from that code into mem
TAG : c
Date : October 18 2020, 11:12 AM , By : malf
Due to Shared memory, when MS Visual C 6.0 DLL crashes it also causes VB 6 EXE to crash
Due to Shared memory, when MS Visual C 6.0 DLL crashes it also causes VB 6 EXE to crash
Hope this helps It has nothing to do with DLLs vs EXEs. It is a thread that crashes. If you don't catch the exception then that will invoke the default exception handler in Windows. Which will terminate the process, optionally telling Microsoft about
TAG : c
Date : October 17 2020, 11:12 PM , By : Fatemeh
Error receiving in UDP: Connection refused
Error receiving in UDP: Connection refused
Hope that helps Chances are your're sending something to a server who does not listen on that particular port. That would cause an icmp message to be sent back , and your next recvfrom will return an error in the case where you connect the socket.Che
TAG : c
Date : October 17 2020, 11:12 PM , By : Vish
How to get the port number from addrinfo in unix c
How to get the port number from addrinfo in unix c
hop of those help? I need to send some data to a remote server via UDP in a particular port and get receive a response from it. However, it is blocking and I do not get any response. I need to check if the addrinfo value that I get from the getaddrin
TAG : c
Date : October 17 2020, 11:12 PM , By : Kelly Whalen
Should I declare the expected size of an array passed as function argument?
Should I declare the expected size of an array passed as function argument?
it fixes the issue The main reason to add an array size is for documentation purposes. Also, with C99, you can add qualifiers within the square brackets which will be used to modify the pointer declaration to which the array declaration will be conve
TAG : c
Date : October 17 2020, 11:12 AM , By : user3851309
Is it possible to read in a string of unknown size in C, without having to put it in a pre-allocated fixed length buffer
Is it possible to read in a string of unknown size in C, without having to put it in a pre-allocated fixed length buffer
To fix the issue you can do At the point that you read the data, your buffer is going to have a fixed size -- that's unavoidable.What you can do, however, is read the data using fgets, and check whether the last character is a '\n', (or you've reache
TAG : c
Date : October 17 2020, 11:12 AM , By : user3851235
How to use pcap_breakloop?
How to use pcap_breakloop?
fixed the issue. Will look into that further You can use alarm to generate a signal after a given number of seconds:
TAG : c
Date : October 16 2020, 11:12 PM , By : Jeff Thompson
C Programming linux , read system inputs like ping or ls -l
C Programming linux , read system inputs like ping or ls -l
This might help you You can use popen, which returns you a stream that you can read the output from. By reading until end-of-file, into a string (probably one that dynamically grows as necessary), you can implement what you're asking for.
TAG : c
Date : October 16 2020, 11:12 PM , By : Marcos Fukaya
Unsigned Short to Unsigned Long assignment
Unsigned Short to Unsigned Long assignment
Does that help The specifier for unsigned long is lu. That for unsigned short is hu. You invoke UB by not using the proper specifiers.
TAG : c
Date : October 16 2020, 11:12 AM , By : lily46
C: strtok on pointer inside a struct
C: strtok on pointer inside a struct
I wish this helpful for you Note that strtok modifies the string - if your txt pointer is pointing at a read-only string (e.g. a const string literal) then you will get an exception.
TAG : c
Date : October 16 2020, 11:12 AM , By : user3851512
How to put bits into a character Array
How to put bits into a character Array
this one helps. I need to know how to put bits into a character array. , Is that really all?
TAG : c
Date : October 15 2020, 11:12 PM , By : kefirzhang
C moving the cursor to the beginning of the current line
C moving the cursor to the beginning of the current line
With these it helps For simply moving the cursor to the beginning of the current line, you may print "\r", which does just that. Notice that it does not erase the old text, so be careful to either overwrite it or to clear with an ANSI code.On systems
TAG : c
Date : October 15 2020, 01:20 AM , By : vivek
libgtk version issue on ubuntu
libgtk version issue on ubuntu
help you fix your problem You can't just install a new libgtk package willy-nilly; you need to upgrade the packages that it depends on, at the same time (in this case, libglib, libcairo, and their respective dev packages).(This question is more appro
TAG : c
Date : October 15 2020, 01:20 AM , By : Joaquín González
creating a list of queues
creating a list of queues
I wish this help you Basically, you need to create one struct for the queue, which is a simple linked list:
TAG : c
Date : October 15 2020, 01:20 AM , By : user3852164
Pointer to a specific fixed address
Pointer to a specific fixed address
help you fix your problem How do you assign a specific memory address to a pointer? , Sure, no problem. You can just assign it directly to a variable:
TAG : c
Date : October 15 2020, 01:20 AM , By : MineLucky
How to parse HTTP responses in C?
How to parse HTTP responses in C?
wish of those help http-parser is a simple and super-fast HTTP parser written in C for the Node.js projectIt's only 2 C files, without any external dependencies.
TAG : c
Date : October 15 2020, 01:18 AM , By : user3852432
Use strtol or strtok to parse a string in C?
Use strtol or strtok to parse a string in C?
wish of those help Use strtol to convert the numbers. The third argument is the base and the special value of 0 will tell strtol to guess based on things like "0x".
TAG : c
Date : October 15 2020, 01:18 AM , By : user3852431_3josh
fread/fwrite string in C
fread/fwrite string in C
seems to work fine I see two problems with the write, you are setting record.nameLength to be too small, and you are passing the wrong pointer to fwrite for the name. record.name is already a pointer.Change this
TAG : c
Date : October 14 2020, 11:12 PM , By : user3852578
c - random number generator
c - random number generator
it should still fix some issue You can generate a pseudorandom number using stdlib.h. Simply include stdlib, then call
TAG : c
Date : October 14 2020, 11:12 PM , By : Patrick H.
input-output in C
input-output in C
will be helpful for those in need , For scanf(), %f is for a float. For double, you need %lf. So,
TAG : c
Date : October 14 2020, 11:12 PM , By : Charly
c - output to file
c - output to file
I hope this helps you . As an alternative to creating two functions (as per AareP's answer), you could add a destination parameter to the output() function:
TAG : c
Date : October 14 2020, 11:12 PM , By : mentat
Reserve RAM in C
Reserve RAM in C
will help you You want to use malloc() to do this. Depending on your need, you will also want to: Write data to the memory so that the kernel actually guarantees it. You can use memset() for this. Prevent the memory from being paged out (swapped), th
TAG : c
Date : October 14 2020, 01:41 PM , By : user3852639
ncurses transparent console background
ncurses transparent console background
Hope this helps If your application calls use_default_colors, ncurses (and NetBSD curses) provide an extension based on ECMA-48 SGR 39 and 49 "default colors". When you do this, ncurses refrains from explicitly coloring cells whose foreground and/or
TAG : c
Date : October 14 2020, 01:41 PM , By : guillaume duval
Faster math library than glibc on x86_64/linux?
Faster math library than glibc on x86_64/linux?
help you fix your problem The math library distributed with ICC is substantially faster for many of the libm functions, but does require purchasing ICC. I believe you can download a free trial version if you're curious about it. I know that they supp
TAG : c
Date : October 14 2020, 01:41 PM , By : user3852847
For buffer overflows, what is the stack address when using pthreads?
For buffer overflows, what is the stack address when using pthreads?
seems to work fine I suggest reading the excellent (if a bit dated) article/tutorial on exploiting buffer overflow vulnerabilities Smashing The Stack For Fun And Profit.Here's a brief excerpt:
TAG : c
Date : October 14 2020, 01:41 PM , By : Nick Julian

shadow
Privacy Policy - Terms - Contact Us © bighow.org