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 NETBSD
inttypes
INTTYPES(3) BSD Library Functions Manual INTTYPES(3)NAME
inttypes -- standard fixed-size integer types
SYNOPSIS
#include <inttypes.h>
DESCRIPTION
The <inttypes.h> header describes a set of format specifier macros aimed to increase portability both within and across operating systems.
It includes the <stdint.h> header and extends it with additional facilities.
Each of the following macros expand to a character string literal containing the format specifier suitable for use within the format argument
of a formatted I/O function such as printf(3). Each macro contains an identifier (PRI or SCN), a conversion specifier, and a possible length
modifier.
The length modifier follows the integer types described in stdint(3):
int8_t uint8_t
int16_t uint16_t
int32_t uint32_t
int64_t uint64_t
int_least8_t uint_least8_t
int_least16_t uint_least16_t
int_least32_t uint_least32_t
int_least64_t uint_least64_t
int_fast8_t uint_fast8_t
int_fast16_t uint_fast16_t
int_fast32_t uint_fast32_t
int_fast64_t uint_fast64_t
intmax_t uintmax_t
intptr_t uintptr_t
The following format specifiers are defined for the fprintf(3) and fscanf(3) families, respectively:
PRI?8 SCN?8
PRI?16 SCN?16
PRI?32 SCN?32
PRI?64 SCN?64
PRI?LEAST8 SCN?LEAST8
PRI?LEAST16 SCN?LEAST16
PRI?LEAST32 SCN?LEAST32
PRI?LEAST64 SCN?LEAST64
PRI?FAST8 SCN?FAST8
PRI?FAST16 SCN?FAST16
PRI?FAST32 SCN?FAST32
PRI?FAST64 SCN?FAST64
PRI?MAX SCN?MAX
PRI?PTR SCN?PTR
The available conversion specifiers, ``?'' in above, are d and i for signed integers and o, u, x, and X for unsigned integers. The X is not
available for the fscanf(3) family. Without the length modifier these would correspond with %d, %i, %o, %u, %x, and %X, respectively.
EXAMPLES
The following example demonstrates typical usage:
uint64_t i = 123;
...
(void)printf("i = %"PRIu64"
", i);
SEE ALSO printf(3), scanf(3), stdint(3)STANDARDS
The <inttypes.h> header conforms to ISO/IEC 9899:1999 (``ISO C99'') and IEEE Std 1003.1-2001 (``POSIX.1'').
HISTORY
The <inttypes.h> header was first introduced in NetBSD 1.6.
BSD March 21, 2010 BSD