Sponsored Content
Full Discussion: Memory fault(coredump)
Homework and Emergencies Homework & Coursework Questions Memory fault(coredump) Post 302552513 by heywoodfloyd on Sunday 4th of September 2011 05:53:52 AM
Old 09-04-2011
changing the s to a d helped a lot. thanks!

this is my new code:
Code:
#include <stdio.h>

main()
{
        int c;
    int nl_cnt = 0;

        while((c = getchar()) != EOF){

                if(c == '\n'){
                nl_cnt++;
                printf("%d ", nl_cnt);}

                putchar(c);

        }

}

this is the output I am getting:

Code:
$ ./line_number < hello.c
1 
#include <stdio.h>2 
3 
main()4 
{5 
    printf("Hello World\n");6 
}7 
8 
9

how do I get the numbers and the code to line up correctly?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Coredump (memory fault)

We are running a SQR program on Unix Platform with Oracle RDBMS. It's an interfacing program to integrate data from foreign sites to PeopleSoft database, using a flat file input. After many hours of processing, the program stops with a coredump error (memory fault). With top command we noticed... (1 Reply)
Discussion started by: araziki
1 Replies

2. Programming

Memory fault(coredump)

Dear All, I made a program which do some simple jobs like reading data from other process's shared memory and writing messages to the queues of other process. what happens is my program works fine and do all the task as expected but then then program ends it give Memory fault(coredump). I... (0 Replies)
Discussion started by: ralo
0 Replies

3. AIX

Segmentation fault(coredump)

Hi All Can anybody help me? When ever am trying to run topas system gives me an error Segmentation fault(coredump) does anybody ahve solution for this? (4 Replies)
Discussion started by: vjm
4 Replies

4. Ubuntu

Memory fault(coredump)

Hey guys, I am new to the Linux world and have a question to post. When I ssh from a HP-UX machine to a ubuntu machine I get the following error message Memory fault(coredump) i.e. ssh 192.168.1.3 I get this message as shown below Memory fault(coredump) Can someone please explain... (2 Replies)
Discussion started by: fkaba81
2 Replies

5. Solaris

memory fault (coredump)

Getting memory fault (coredump) and segmentation fault(coredump) when i tried javac or java -version. what could be the problem? Regards Eswar (2 Replies)
Discussion started by: BhuvanEswar
2 Replies

6. Shell Programming and Scripting

Segmentation Fault(coredump)

I'm getting this error when trying to run a Acucobol program thru UNIX.. Segmentation Fault(coredump) Precompiler error prevents compilation of xxxxxx.co. Please help me in this case.. (1 Reply)
Discussion started by: Manish4
1 Replies

7. Programming

Memory fault(coredump) while using Environment variables

Hi, Actually I am facing one issue while using the getenv() in the C/C++ program. I want to take the file path from environment variables and if am not defining the environment path, its showing the message like this…! Memory fault(coredump) Actually I want to handle the error ,... (6 Replies)
Discussion started by: Kattoor
6 Replies

8. Shell Programming and Scripting

Memory fault(coredump) while using cat cmd

i have few log files that are input to my perl script... i am executing the script as below cat RTR*.log | test.pl and getting the following error -ksh: 25014: Memory fault(coredump) cat: write error: Connection reset by peer can anyone help me on this.... Thanks in... (2 Replies)
Discussion started by: niteesh_!7
2 Replies

9. AIX

Error: Memory fault(coredump)

Hi Experts, While running a command, i saw this error below # ls -lrt total 74008 -rw-r--r-- 1 rr57104 edcfes 37889134 May 16 12:41 LGTOnw.clnt.7.4.2.0.bff.tar.gz drwxr-xr-x 2 root system 256 May 18 12:42 lost+found # gunzip LGTOnw.clnt.7.4.2.0.bff.tar.gz Memory fault(coredump) ... (2 Replies)
Discussion started by: EngnrRG
2 Replies

10. UNIX for Advanced & Expert Users

Memory fault(Coredump)

Hi, In my application we have one job which is used to process the files. But that job is failing with memory fault while processing a file or while shutting down the job. Sometime it generates the coredump and sometimes not. When I analysed the core dump I got below code snippet where it... (3 Replies)
Discussion started by: shilpa_20
3 Replies
TEXIFY(1)						      General Commands Manual							 TEXIFY(1)

NAME
texify - format code for use with LaTeX SYNOPSIS
texify<input-type> [OPTION]... DESCRIPTION
texify translates source code written in any of several different languages to latex(1) source files. The purpose is to make source code embedded in documents more readable, by providing syntax highliting. OPTIONS
-i FILE Read from FILE instead of standard input. -o FILE Write to FILE instead of standard output. -l LENGTH Limit line length to LENGTH. -t LENGTH Make a tab correspond to LENGTH spaces. Default is 6. -num INTERVAL Prefix output lines with the corresponding line number from the input, skipping INTERVAL lines between each time a prefix is added. An interval of 1 will ensure that every line is prefixed. -numsize exsize Replace the TeX code used to set the size of the line numbers. The default is footnotesize. INPUT TYPES
abel ABEL source code ada Ada source code asm Assembly code axiom AXIOM code B B source code beta BETA source code bison Bison source code c C source code c++ C++ source code idl OMG/CORBA IDL source code java Java source code lex Lex source code lisp LISP source code logla LOGLA source code matlab MATLAB script ml ML source code perl Perl source code promela Promela source code python Python source code scheme Scheme soruce code sim SIMULA source code sql SQL queries ruby Ruby source code vhdl VHDL description This manual page was written for the Debian operating system because the original program does not have a manual page. EXAMPLES
Say you want to format a Java source file. Just type: texifyjava < input.java > output.tex You can also format the output of some program without storing its output in a temporary file. If you want to format the output of a Post- greSQL database dump, just type: pg_dump foobar | texifysql > output.tex AUTHOR
This manual page was written by Morten Hustveit <morten@debian.org>. January 2003 TEXIFY(1)
All times are GMT -4. The time now is 08:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy