Sponsored Content
Top Forums Programming Data formating using C programm with Hex deciamal 'x0d' Post 302300749 by gautamdheeraj on Wednesday 25th of March 2009 01:47:44 AM
Old 03-25-2009
try with bzeroing req_msg before following statement.

Quote:
sprintf(req_msg, "%s%s%s%s", req_line1,req_line2,req_line3,req_line4);
- Dheeraj
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How can install a programm?

Hello Friends, I have a problem with install.can u tell me how can I install a programm?I use AIX(IBM) system. And how can i access cd-rom?I can't mounted,coz i am not Root.(can u tell me another Command /way)? Thanks all. (1 Reply)
Discussion started by: Christianto
1 Replies

2. Programming

run other programm

I have the programm, that says to STDERR(not to STDOUT!): "hello world!" and this programm is compiled and I have no sources. When I try to open this programm in another using C: ======================================= FILE *pp = popen("hello_to_stderr.exe", "r"); int c; string a; ... (2 Replies)
Discussion started by: shalmoo
2 Replies

3. UNIX for Advanced & Expert Users

hex data conversion

Dear friends, I have hexadecimal data like this. now i want to read each letter and convert to decimal format. for example.: from the below data first i have to read hex data 0 and convert to 4 bit decimal value ie 0000. similarly second letter 8 decimal value is 1000. like this.... (6 Replies)
Discussion started by: rajan_ka1
6 Replies

4. Shell Programming and Scripting

How to embeded programm within programm

Hi, How to embeded programme within perl programme. Shankarao (2 Replies)
Discussion started by: shankarao
2 Replies

5. Programming

After converting the hexstr to Hex and storing the Hex in a char*

Hi All, My main intension of is to convert the Hexstring stored in a char* into hex and then prefixing it with "0x" and suffix it with ',' This has to be done for all the hexstring char* is NULL. Store the result prefixed with "0x" and suffixed with ',' in another char* and pass it to... (1 Reply)
Discussion started by: rvan
1 Replies

6. Shell Programming and Scripting

Replacing hex characters '\x0D' with '\x0D\x0A'

Hello All, I have a requirement where I need to replaced the hex character - '\x0D' with 2 hex characters - 'x0D' & 'x0A' I am trying to use SED - But somehow its not working. Any pointers? Also the hex character '\x0D' can occur anywhere in the line. Can this also be accomplished... (6 Replies)
Discussion started by: paragkalra
6 Replies

7. Shell Programming and Scripting

Reading hex data from assembler

Hi, I have files that has got ebcdic character set and also, there are fields like binary and hex fields. is there a way to convert this to normal ascii data by taking care of comp & comp-3 fields? Many Thanks!! (10 Replies)
Discussion started by: ahmedwaseem2000
10 Replies

8. Programming

What is the difference between ios::hex and std::hex?

Hi, Is there really a difference between these two, std::hex and ios::hex?? I stumbled upon reading a line, "std::ios::hex is a bitmask (8 on gcc) and works with setf(). std::hex is the operator". Is this true? Thanks (0 Replies)
Discussion started by: royalibrahim
0 Replies

9. Shell Programming and Scripting

how to get data from hex file using SED or AWK based on pattern sign

I have a binary (hex) file I need to parse to get some data which are encoded this way: .* b4 . . . 01 12 .* af .* 83 L1 x1 x2 xL 84 L2 y1 y2 yL By another words there is a stream of hexadecimal bytes (in my example separated by space for better readability). I need to get value stored in... (3 Replies)
Discussion started by: sameucho
3 Replies

10. Shell Programming and Scripting

Losing carriage return (X0D) after running awk command

Hi Forum. I'm running the following awk command to extract the suffix value (pos 38) from the "AM00" record and append to the end of the "AM01" record. awk 'substr($0,13,4)=="AM00" {SUFFIX = substr($0,38,2)} substr($0,13,4)=="AM01" {$0 = $0 SUFFIX} 1' before.txt > after.txt Before.txt:... (2 Replies)
Discussion started by: pchang
2 Replies
explain_sprintf(3)					     Library Functions Manual						explain_sprintf(3)

NAME
explain_sprintf - explain sprintf(3) errors SYNOPSIS
#include <libexplain/sprintf.h> const char *explain_sprintf(char *data, const char *format, ...); const char *explain_errno_sprintf(int errnum, char *data, const char *format, ...); void explain_message_sprintf(char *message, int message_size, char *data, const char *format, ...); void explain_message_errno_sprintf(char *message, int message_size, int errnum, char *data, const char *format, ...); DESCRIPTION
These functions may be used to obtain explanations for errors returned by the sprintf(3) system call. explain_sprintf const char *explain_sprintf(char *data, const char *format, ...); The explain_sprintf function is used to obtain an explanation of an error returned by the sprintf(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. data The original data, exactly as passed to the sprintf(3) system call. format The original format, exactly as passed to the sprintf(3) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. Example: This function is intended to be used in a fashion similar to the following example: errno = EINVAL; int result = sprintf(data, format, ...); if (result < 0) { fprintf(stderr, "%s ", explain_sprintf(data, format, ...)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_sprintf_or_die(3) function. explain_errno_sprintf const char *explain_errno_sprintf(int errnum, char *data, const char *format, ...); The explain_errno_sprintf function is used to obtain an explanation of an error returned by the sprintf(3) system call. The least the mes- sage will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. data The original data, exactly as passed to the sprintf(3) system call. format The original format, exactly as passed to the sprintf(3) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. Example: This function is intended to be used in a fashion similar to the following example: errno = EINVAL; int result = sprintf(data, format, ...); if (result < 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_sprintf(err, data, format, ...)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_sprintf_or_die(3) function. explain_message_sprintf void explain_message_sprintf(char *message, int message_size, char *data, const char *format, ...); The explain_message_sprintf function is used to obtain an explanation of an error returned by the sprintf(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. data The original data, exactly as passed to the sprintf(3) system call. format The original format, exactly as passed to the sprintf(3) system call. Example: This function is intended to be used in a fashion similar to the following example: errno = EINVAL; int result = sprintf(data, format, ...); if (result < 0) { char message[3000]; explain_message_sprintf(message, sizeof(message), data, format, ...); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_sprintf_or_die(3) function. explain_message_errno_sprintf void explain_message_errno_sprintf(char *message, int message_size, int errnum, char *data, const char *format, ...); The explain_message_errno_sprintf function is used to obtain an explanation of an error returned by the sprintf(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. data The original data, exactly as passed to the sprintf(3) system call. format The original format, exactly as passed to the sprintf(3) system call. Example: This function is intended to be used in a fashion similar to the following example: errno = EINVAL; int result = sprintf(data, format, ...); if (result < 0) { int err = errno; char message[3000]; explain_message_errno_sprintf(message, sizeof(message), err, data, format, ...); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_sprintf_or_die(3) function. SEE ALSO
sprintf(3) formatted output conversion explain_sprintf_or_die(3) formatted output conversion and report errors COPYRIGHT
libexplain version 0.52 Copyright (C) 2010 Peter Miller explain_sprintf(3)
All times are GMT -4. The time now is 02:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy