If you can find a suitable scanf-format, you might be able to do it all with one fscanf. If you have to change things later, this could be useful, or not. Probably not, but you are the judge.
I have data that looks like this
aaa!bbb!ccc/ddd/eee
It is not fixed format. I need to parse ddd into a var in order to decide if I want to process that row. If I do I need to put ccc and bbb into vars to process it. I need to do this during a while loop one record at a time. Any... (11 Replies)
i am trying to use the history functions in a c++ program along with a custom signal handler for SIGINT.
the prog works fine catching signals without the line:
add_history(*args);
but as soon as this line is added, the prog segfaults on SIGINT.
does anyone have experience using gnu... (2 Replies)
Hello, sorry if this has been posted before but i was wondering if there is a way to run a program until a segmentation fault is found.
Currently i'm using a simple shell script which runs my program 100 times, sleeps 1 second because srand(time(0)) is dependent on seconds. Is there a possible... (1 Reply)
We have a Solaris 8 server which users login to via VNC to get a desktop. On that desktop these users use Netscape Communicator 4.9 to access a very important mail account. Unfortunately Netscape has started segfaulting regularly.
Does anyone have any ideas how I can try to find out what point... (1 Reply)
1. Even if i have the handles for ctrl+c it gives off a segfault
2. syslog doesn't log LOG_ERR event with log masked specified or non specified, it logs LOG_WARNING however...
#include <sys/types.h> /* include this before any other sys headers */
#include <sys/stat.h>
#include <fcntl.h>... (2 Replies)
Hello everyone,
I'm writing a program using the id3lib unfortunately I've encountered with memory issue that cause segmentation fault. I tried to rerun and analyze the program with valgrind but it doesn't point me anywhere. I really stuck on this one.
Valgrind output:
==14716== Invalid read of... (2 Replies)
I have a program that allows users to specify the debug log file location and name.
I have tried using the access() and stat() but they both segfault if the drive say (d:\) is invalid. Both seem to be fine if the drive exists.
Could someone please point me in the direction to a function that... (1 Reply)
hello all,
my question is not about How code can be rewritten, i just wanna know even though i am not using read only memory of C (i have declared str) why this function gives me segfault :wall:and the other code executes comfortably though both code uses same pointer arithmetic.
... (4 Replies)
I am populating an array of string and print it.
But it going in infinite loop and causing segfault.
char Name = {
"yahoo",
"rediff",
"facebook",
NULL
};
main(int argc, char* argv)
{
int j = 0;
... (7 Replies)
Hello:
I have some text output, on SunOS 5.11 platform using KSH:
I am trying to parse out each string within the () for each line.
I tried, as example:
perl -lanF"" -e 'print "$F $F $F $F $F $F"'
But for some reason, the output gets all garbled after the the first fields.... (8 Replies)
Discussion started by: gilgamesh
8 Replies
LEARN ABOUT SUNOS
inttypes
inttypes.h(3HEAD) Headers inttypes.h(3HEAD)NAME
inttypes.h, inttypes - fixed size integer types
SYNOPSIS
#include <inttypes.h>
DESCRIPTION
The <inttypes.h> header includes the <stdint.h> header.
The <inttypes.h> header includes a definition of the following type:
imaxdiv_t structure type that is the type of the value returned by the imaxdiv() function.
The following macros are defined. Each expands to a character string literal containing a conversion specifier, possibly modified by a
length modifier, suitable for use within the format argument of a formatted input/output function when converting the corresponding integer
type. These macros have the general form of PRI (character string literals for the fprintf() and fwprintf() family of functions) or SCN
(character string literals for the fscanf() and fwscanf() family of functions), followed by the conversion specifier, followed by a name
corresponding to a similar type name in <stdint.h>. In these names, N represents the width of the type as described in <stdint.h>. For
example, PRIdFAST32 can be used in a format string to print the value of an integer of type int_fast32_t.
The fprintf() macros for signed integers are:
PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
The fprintf() macros for unsigned integers are:
PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
The fscanf() macros for signed integers are:
SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
The fscanf() macros for unsigned integers are:
SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
For each type that the implementation provides in <stdint.h>, the corresponding fprintf() and fwprintf() macros must be defined. The cor-
responding fscanf() and fwscanf() macros must be defined as well, unless the implementation does not have a suitable modifier for the type.
USAGE
The purpose of <inttypes.h> is to provide a set of integer types whose definitions are consistent across machines and independent of oper-
ating systems and other implementation idiosyncrasies. It defines, with a typedef, integer types of various sizes. Implementations are free
to typedef them as ISO C standard integer types or extensions that they support. Consistent use of this header greatly increases the porta-
bility of applications across platforms.
EXAMPLES
Example 1: Use of Macro
The following code uses one of the macros available through <inttypes.h>.
#include <inttypes.h>
#include <wchar.h>
int main(void)
{
uintmax_t i = UINTMAX_MAX; // This type always exists.
wprintf("The largest integer value is %020"
PRIxMAX, "
", i);
return 0;
}
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO imaxdiv(3C), attributes(5), standards(5)SunOS 5.10 10 Sep 2004 inttypes.h(3HEAD)