Inputting with SPACES...


 
Thread Tools Search this Thread
Top Forums Programming Inputting with SPACES...
# 1  
Old 06-01-2011
Inputting with SPACES...

I can't seem to successfully output characters with spaces. I inputted using getchar().
Any other ideas?
Thank you in advance!

Code:
printf ("Enter the Title [Use dots instead of spaces]: ");
      int i = 0;
      int c1;
      while (( c1!= '\n')&& (i <21))
      {
      new_name->title[i] = c1; 
      i++;                
      c1= (char)getchar();
      } 
      new_name->title[i] = '\0';
      while  (( c1= (char) getchar()) != '\n');

OutPut:
Code:
void list_names (void)
/* List all names in the book */
{
    REMINDER *tmp_ptr; /* Traverses list */
    printf ("All names in address book:\n");
    tmp_ptr= hol;

    while (tmp_ptr != NULL) 
     {
 printf ("title: %s\n",tmp_ptr->title);
}
}

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

C: inputting string of unknown length

I realize this general issue (inputting strings of variable length in C) has been addressed in myriad locations before, but I'm interested in knowing why my specific approach is not working. (BTW I'm intentionally keeping the size increments small so that I can more easily follow what's going on.... (5 Replies)
Discussion started by: DevuanFan
5 Replies

2. Shell Programming and Scripting

Inputting multiple files into one command

I am trying to read 30 files into a command. The first file contains 10 lines and goes into this part of the command as "x" /tmp/filearrange.sh $x The group of files (20 files, I call them variable $i) need to be the second argument in the command and they need to be read so that they are... (9 Replies)
Discussion started by: newbie2010
9 Replies

3. UNIX for Dummies Questions & Answers

Inputting info

Hey guys! So I'm working on a program in linux terminal, using perl, to convert dna alignments to amino acid. It involves reading in one sequence and outputting another. I have it set so I can input a file but I can't input any sequences manually, anyone got any ideas about it? I have it set up... (0 Replies)
Discussion started by: PerlNutt
0 Replies

4. Shell Programming and Scripting

Script template for inputting filenames and print results

Hi, Hope you are all well. New to scripting, and all those characters are all a new language for me. Though hoping to get my little head round it all sooner or later. I was wondering whether anyone could help with a script template example. What I would like to happen is to run the script... (8 Replies)
Discussion started by: loky27
8 Replies

5. UNIX for Dummies Questions & Answers

Inputting text to a specific line of a file

Hi all, I have a script which uses a basic line to add text into another file e.g. grep -i test * >> test.txt Is there a way I can get the output of the grep to output to a specific line in the text.txt for example output above the line starting "Bottom line..." (6 Replies)
Discussion started by: JayC89
6 Replies

6. Homework & Coursework Questions

C++ inputting multiple strings

Hi All, We've been given the exercise below and I'm stumbling at the first block because we have to take in 20 student names and I don't know how to store them! :( I know that I can create (initialize) 20 different char arrays but this seems wrong somehow... What's the best way to store... (2 Replies)
Discussion started by: pondlife
2 Replies

7. Shell Programming and Scripting

Removing blank spaces, tab spaces from file

Hello All, I am trying to remove all tabspaces and all blankspaces from my file using sed & awk, but not getting proper code. Please help me out. My file is like this (<b> means one blank space, <t> means one tab space)- $ cat file NARESH<b><b><b>KUMAR<t><t>PRADHAN... (3 Replies)
Discussion started by: NARESH1302
3 Replies

8. UNIX for Dummies Questions & Answers

how to append spaces(say 10 spaces) at the end of each line based on the length of th

Hi, I have a problem where I need to append few spaces(say 10 spaces) for each line in a file whose length is say(100 chars) and others leave as it is. I tried to find the length of each line and then if the length is say 100 chars then tried to write those lines into another file and use a sed... (17 Replies)
Discussion started by: prathima
17 Replies

9. Shell Programming and Scripting

Problem with inputting password

Hi all, In one of my script, somewhere I need to input password of a server when ssh password's prompt comes. I've tried with EOF but it's not taking. I don't want to disable password through ssh. I want the password should be passed with my script. Any suggestion? Thanks in advance! (2 Replies)
Discussion started by: naw_deepak
2 Replies

10. Shell Programming and Scripting

Strip leading and trailing spaces only in a shell variable with embedded spaces

I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help. echo $SH_VAR | command_line Syntax. The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies
Login or Register to Ask a Question
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)