Can 't convert from a character to octal value in memory
Can 't convert from a string to an octal in memory using either
of the two sprintf (three_oct_char, "%o", single_char); sscanf (single_char, "%o", three_oct_char); ======================================== three_oct_char = 27777776450 ---> incorrect value single_char = / octal_long = 57 three_oct_char = 27777776450 ---> incorrect value single_char = p octal_long = 160 three_oct_char = 27777776450 ---> incorrect value single_char = r octal_long = 162 three_oct_char = 27777776450 ---> incorrect value single_char = o octal_long = 157 three_oct_char = 27777776450 --- > incorrect value single_char = c octal_long = 143 ======================================== Code:
#include <stdio.h> |
Linh.. can you please put [code] [/code] tags around your code when you post??? It's really difficult to read your code without them!
All you have to do is say [code] #!/usr/bin/perl print "blah blah blah\n"; [/code] and it comes out as: Code:
#!/usr/bin/perl Thanks!!!!!! (= |
syntax error
Thank you TheLinuxDuck for the hint, I will use that from now on.
============================================ The line #2 below should be changed from a %o to %s 2 ---> printf ("three_oct_char = %o\n", three_oct_char); change from a %o to %s would cause it to print correctly 2 ---> printf ("three_oct_char = %s\n", three_oct_char); ============================================ |
All times are GMT -5. The time now is 12:20 AM. |