Sponsored Content
Top Forums Programming C: Memory Fault (core dumped) Post 302815303 by Corona688 on Friday 31st of May 2013 12:20:53 PM
Old 05-31-2013
One way perhaps:

Code:
char *string="12345";
int value;

if(sscanf(string, "%d", &value) != 1)
{
        fprintf(stderr, "'%s' is not a number\n", string);
}

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Segmentation fault (core dumped)

Hello To All! Now anfd then I receive a message on my console: Segmentation fault (core dumped) What does it mean? Or more precisely what are the implications? :confused: (1 Reply)
Discussion started by: Ivo
1 Replies

2. Programming

Segmentation Fault (core dumped)

what r the situations to receive an error msg like the one below Segmentation Fault (core dumped) (2 Replies)
Discussion started by: bankpro
2 Replies

3. UNIX for Advanced & Expert Users

Memory Fault - Core Dumped

I use SCO UNIX 5.07 on a Compaq Proliant Machine. Each time I press the Escape or Delete key while running a program or issuing a FoxBase+ command from the dot prompt, I receive the error message: "Memory Fault - Core Dumped" and the screen locks up immediately. I would appreciate if necessary... (0 Replies)
Discussion started by: bayuz
0 Replies

4. Programming

Memory Fault,Core dumped

I have written a code in UNIX which is complied by using g++. Compling with turbo C didnt yield any errors, but with g++ I am getting Memory fault, core dumped. Could anyone help me out with this? Given below is the code: #include<stdio.h> #include<string.h> #include<stdlib.h>... (2 Replies)
Discussion started by: usshell
2 Replies

5. Solaris

Segmentation Fault (core dumped)

i am getting Segmentation Fault (core dumped) on solaris, but when i run the same program with same input on linux it runs successfully. How can i trace the fault in program on solaris. (6 Replies)
Discussion started by: junaid.nehvi
6 Replies

6. UNIX for Dummies Questions & Answers

Segmentaion Fault - Core dumped during cpio

The same cpio script has been working for years without modifications, until the last couple of nights when we get the error Segmentation Fault - core dumped and the cpio aborts. It appears to abort in relatively the same place every time and on multiple tapes. Do I have a bad tape drive,... (8 Replies)
Discussion started by: golfs4us
8 Replies

7. Solaris

segmentation fault core dumped

i am getting segmentation fault (core dumped) i tried following things but couldn't understand what is wrong with my prog and where the problem is.... i have only adb debugger available on solaris.... so plz help bash-3.00$ pstack core core 'core' of 765: ./mod_generalised_tapinread... (4 Replies)
Discussion started by: junaid.nehvi
4 Replies

8. Red Hat

Segmentation fault (core dumped)

Hi All, I am getting "Segmentation fault (core dumped)" error in the runtime. I am new this please can you tell me why is that i am getting this error and I am not sure of my compilation : gcc -c avc_test.c gcc -c md5.c gcc avc_test.o md5.o -shared -Llibcoreavc_sdk.so -o proj ... (1 Reply)
Discussion started by: fido.genial
1 Replies

9. Programming

Memory Fault (core dumped) in ttpy program

I´m writing this program in QNX , I`m kinda new to UNIX and programing in general, and when I try to run it it gives me the Memory Fault error. Can anyone help? #include <stdio.h> #include <fcntl.h> void main(void) {int a,ter; char buf; printf("a="); scanf("%d",a); ter=open... (6 Replies)
Discussion started by: GiganteAsesino
6 Replies

10. UNIX and Linux Applications

Tilda Segmentation fault (core dumped)

Can anyone tell me why I keep getting a Segmentation fault when I try to run tilda? $ tilda Segmentation fault (core dumped) It seemed to run after I deleted my tilda directory like this thread said to do. Unfortunately it wouldn't let me set my keybinding with anything I tried. ... (0 Replies)
Discussion started by: cokedude
0 Replies
SD_JOURNAL_STREAM_FD(3) 				       sd_journal_stream_fd					   SD_JOURNAL_STREAM_FD(3)

NAME
sd_journal_stream_fd - Create log stream file descriptor to the journal SYNOPSIS
#include <systemd/sd-journal.h> int sd_journal_stream_fd(const char* identifier, int priority, int level_prefix); DESCRIPTION
sd_journal_stream_fd() may be used to create a log stream file descriptor. Log messages written to this file descriptor as simple newline-separated text strings are written to the journal. This file descriptor can be used internally by applications or be made STDOUT/STDERR of other processes executed. sd_journal_stream_fd() takes a short program identifier string as first argument, which will be written to the journal as _SYSLOG_IDENTIFIER= field for each log entry (see systemd.journal-fields(7) for more information). The second argument shall be the default priority level for all messages. The priority level is one of LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG, as defined in syslog.h, see syslog(3) for details. The third argument is a boolean: if true kernel-style log priority level prefixes (such as SD_WARNING) are interpreted, see sd-daemon(3) for more information. It is recommended that applications log UTF-8 messages only with this API, but this is not enforced. RETURN VALUE
The call returns a valid write-only file descriptor on success or a negative errno-style error code. NOTES
The sd_journal_stream_fd() interface is available as a shared library, which can be compiled and linked to with the libsystemd-journal pkg- config(1) file. EXAMPLES
Creating a log stream suitable for fprintf(3): #include <syslog.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <systemd/sd-journal.h> #include <systemd/sd-daemon.h> int main(int argc, char *argv[]) { int fd; FILE *log; fd = sd_journal_stream_fd("test", LOG_INFO, 1); if (fd < 0) { fprintf(stderr, "Failed to create stream fd: %s ", strerror(-fd)); return 1; } log = fdopen(fd, "w"); if (!log) { fprintf(stderr, "Failed to create file object: %m "); close(fd); return 1; } fprintf(log, "Hello World! "); fprintf(log, SD_WARNING "This is a warning! "); fclose(log); return 0; } SEE ALSO
systemd(1), sd-journal(3), sd-daemon(3), sd_journal_print(3), syslog(3), fprintf(3), systemd.journal-fields(7) systemd 208 SD_JOURNAL_STREAM_FD(3)
All times are GMT -4. The time now is 10:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy