Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
85 views

When I set a DEBUG trap in Bash like this: set -o functrace trap 'echo "# $BASH_COMMAND" >&2' DEBUG Suddenly, this function stopped working: getBase() { local base="$1" ...
Maestro's user avatar
  • 9,876
0 votes
0 answers
76 views

` void DisplayFood(int*NumOfFood,int*Rno,char *Names[],int*Price,int*Quantity,char*mfg[],char*exp[]) { int i =0; for(i=0;i<*NumOfFood;i++) { printf("\n%-20d",Rno[i]); ...
Trương Công Trình's user avatar
0 votes
0 answers
216 views

I'm trying to convert the unsigned long integer converted_binary, which contains 10000000000 to a string, but sprintf converts it to a single character 1 instead. I am able to know this through the ...
Olamide Olanrewaju's user avatar
1 vote
2 answers
293 views

I have a debugger class which implements a printf() c style method. It looks like this: #define NO_DEBUG 0 #define NO_PREFIX 1 #define DEBUG_INFO 2 #define DEBUG_SUCCESS 3 #define DEBUG_WARN 4 #define ...
Dr.Random's user avatar
  • 520
0 votes
1 answer
102 views

Here is a simple module containing a down counter: import chisel3.util.{Valid, DeqIO} class Input(WIDTH : Int) extends Bundle { val x = UInt(WIDTH.W) } class Output(WIDTH : Int) extends Bundle { ...
Gaslight Deceive Subvert's user avatar
-2 votes
1 answer
140 views

I have an question about the .exe log. I am using raspberry pi 4 module with Debian OS where I am running my c-program from the .service base auto-start .exe process. Which is running well So whenever ...
Ketan Vadodariya's user avatar
1 vote
1 answer
134 views

I am learning how to create struct's and I am stuck on a program I made. Everything works fine until I try to input "2". When the program prints the symbol it's supposed to be "He" ...
Nightmare Sky's user avatar
0 votes
0 answers
87 views

Hi I am new to C but not to programming(Only have experience in high-level languages like Python and JS). In my CS assignment I have to implement a function that decodes an encrypted string.(The ...
Grey_dev1997's user avatar
0 votes
1 answer
73 views

I finished the challenge and my first C code worked apparently well, returning each time the correct minimum number of coins needed for change. Then when I tried to "clean it up" a bit and remove a ...
Daniel Fernandez's user avatar
0 votes
1 answer
1k views

Please note this is not C++ code and I'm not developing a Qt app. I mostly develop embedded code and someone has knocked up a neat LCD emulator so we can write quite a lot of the code independent of ...
DiBosco's user avatar
  • 876
0 votes
1 answer
535 views

See my code char t[]= "{\n abcdeffgjejgjergnjkengkknkn \n"; printf("%s",t); char t1[]= "{ abcdeffgjejgjergnjkengkknkn \n aaffdefa"; printf("%s",t1); Actual Output: { { abcdeffgjejgjergnjkengkknkn ...
jtro's user avatar
  • 151
0 votes
3 answers
2k views

Why does the following code produce an error? I don't understand why the curly braces are making a difference. #include<stdio.h> int main(void) { { int a=3; } { ...
Debmalya Panday's user avatar
1 vote
3 answers
775 views

I can't understand why the following code outputs 10. What I understand is that !printf("0") means !0, which is TRUE. So why doesn't the code print "Sachin" #include <stdio.h> int main() { ...
Debmalya Panday's user avatar
0 votes
4 answers
89 views

My program is supposed to print out a table like this: Time Fraction Since Midnight 12:00 AM 0.0000 1:00 AM 0.0417 2:00 AM 0.0833 3:00 AM 0....
newtojava's user avatar
-1 votes
1 answer
1k views

I have a string array in a matlab script called "dataString" that was copied into MATLAB from an html document using fileread(). I then cut out the part I wanted and stored that in dataString. TEXT =...
Unique Worldline's user avatar
1 vote
3 answers
137 views

I have some bash scripts I have been running on Ubuntu 14.04 and 16.04 for well over a year now. Some recent Ubuntu update has broken bash and I cannot figure out how to sort this out. Example: #!/...
MitchellK's user avatar
  • 2,752
0 votes
2 answers
1k views

Language is C. I have an array of char* types (char *array[] / char** array) as function argument, and I want to print them all to separate lines like this: while (*array) { printf("%s\n", ...
Ville Miekk-oja's user avatar
2 votes
4 answers
29k views

I am trying to print a parenthesis using: printf("\)"); However, it is giving me the following warning: warning: unknown escape sequence '\)' I can't seem to find a clear explanation anywhere on how ...
user5799707's user avatar
2 votes
1 answer
8k views

I want to pass application printf log messages to the /var/log/messages. Because kernel debug messages can be visible to /var/log/messages.But i am not getting how to pass application printf log ...
Deepak Singh's user avatar
  • 1,169
31 votes
2 answers
11k views

I have some code #define DEBUG_PRINT(x,...) \ do \ {\ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wunused-value\"") \ __typeof__((0,x)) _x = x; ...
Roman A. Taycher's user avatar
-1 votes
1 answer
464 views

I have main.cpp, linking test function from io.c #include <iostream> #include "io.h" int main(int argc, char **argv) { test(); return 0; } io.c: #include <stdio.h> #include "io....
Kopro's user avatar
  • 1
-3 votes
2 answers
132 views

I finally got my change program to print out some numbers instead of throwing a floating point exception. However, now it is slightly off. Instead of giving 2 quarters, 1 dime, 1 nickel, and 2 pennies,...
Jordan's user avatar
  • 912
0 votes
1 answer
760 views

I'm trying to port software to a microcontroller (so I can't step through the code with e.g. gdb) and it crashes unpleasantly. To identify the reason for this, I want to insert a printf() before every ...
user1273684's user avatar
  • 1,619
1 vote
4 answers
2k views

I'd like to know how to get the line number of a line in vbscript programmaticly either at the point of the code like __LINE__ or more ideally a way to get the line number of where the current ...
Roman A. Taycher's user avatar
0 votes
1 answer
583 views

in c code I frequently use printf debugging macros like #define DPRINT_INT(i) fprintf(stderr,"%s has the value %i at line %i", #i,i, __LINE__) and then i can do things like DPRINT_INT(height) where ...
Roman A. Taycher's user avatar
8 votes
3 answers
1k views

I have a bunch of printf debug helper macros and it would be pretty cool to have to not specify the type, is there anything you can do to allow something like macro overloading in c(can be gcc ...
Roman A. Taycher's user avatar
6 votes
2 answers
8k views

I am trying to understand a Linux kernel module and would like to see the output of pr_debug and printk. I am using GNU Make. I understand that to get pr_debug messages, we have to use DDEBUG. ...
db42's user avatar
  • 4,554
62 votes
6 answers
12k views

coming from the Ocaml community, I'm trying to learn a bit of Haskell. The transition goes quite well but I'm a bit confused with debugging. I used to put (lots of) "printf" in my ocaml code, to ...
Vinz's user avatar
  • 6,057
8 votes
11 answers
3k views

I remember when I was in some course of C programming, a teacher once suggested that I use printf to watch the execution of a program that I was trying to debug. This program had a segmentation fault ...
YuppieNetworking's user avatar
45 votes
6 answers
22k views

I'm sure it's a silly question to those who know, but I can't find an explanation of what it does or what it is. CSV.open('data.csv', 'r') do |row| p row end What does "p row" do?
James P. Wright's user avatar
-1 votes
2 answers
139 views

I was once asked during an interview the following question, and I've still never been quite clear on the answer. I was wondering if anyone knew where I could learn more, googling hasn't been much ...
user avatar
3 votes
7 answers
4k views

As many young programmers do, I learned the usefulness of inserting numerous print-to-console statements of "here1," "here2," and so on at different points in code to figure out when my programs are ...
JoeCool's user avatar
  • 4,432
330 votes
11 answers
249k views

When I'm running a simple Ruby script, what's the easiest way to dump an object's fields to the console? I'm looking for something similar to PHP's print_r() that will work with arrays as well.
roryf's user avatar
  • 30.2k
49 votes
19 answers
31k views

There are many ways of doing debugging, using a debugger is one, but the simple one for the humble, lazy, programmer is to just add a bunch of print statements to your code. i.e. def foo(x): ...
Jerub's user avatar
  • 42.8k