Full Discussion: convert without using strtol
Top Forums Programming convert without using strtol Post 302137275 by BMW750LIuser on Monday 24th of September 2007 06:00:27 AM
convert without using strtol

Hi I need help with some function. I have to fetch data from stdin without using of scanf() (I have to use getc or getchar) and then each sign I want to convert to another sign - here I can't use function strtol Smilie . In the end i want to print this string to stdout without using of function printf (I have to use putc or putchar)

Thank all very much fot each idea
Test Your Knowledge in Computers #552
Difficulty: Medium
If variable i has the value 10, after x = 5 + (++i); the value of x after this code is 15.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

To convert

Hi, I have a source file with 'Aug 1 2004' kind format. I need to search the records with certain period, like from Aug 1 2004 to Sep 20 2004. Can someone give me some ideas what I should start with? ThanX !! (1 Reply)
Discussion started by: whatisthis
1 Replies

2. Shell Programming and Scripting

Convert database

We use the MS access database, I want to convert the database to mysql db , could suggest is there any tools / methods that I can export the table and data from access , and import it to the new mysql db ? thx in advance. (3 Replies)
Discussion started by: ust
3 Replies

3. Shell Programming and Scripting

here-doc convert 2 script convert to single script?

I have my main script calling another script to retrive a "ls -alt" of a directory that's located in a remote location I'm sftping into. main.sh #!/bin/ksh getLS.sh > output.txt getLS.sh #!/bin/sh /home<..>/sftp <host@ip> <<! cd /some/dir/Log ls -alt quit ! Basically I'd like to be... (2 Replies)
Discussion started by: yongho
2 Replies

4. Shell Programming and Scripting

convert to GB

hello, my objective is to calculate the swap size -bash-3.00# swap -l swapfile dev swaplo blocks free /dev/md/dsk/d1 85,1 8 33559776 16966160 so size=blocks*512/(1024*1024*1024) since blocks are 512-blocks any idea how to get it? so far I was able to... (6 Replies)
Discussion started by: melanie_pfefer
6 Replies

5. Shell Programming and Scripting

help to convert

how to convert this perl expression to Python while (<FIL>) { s/+/ /g; if (/<DOC\s+doc_ID=\"(.*?)\".*sys_ID=\"(.*?)\"/i) { #" ${$$hashptr{$sys_Id}}{$doc_Id} = $docstr; # push(@$doclistptr, $doc_Id); $doc_Id = $1; $sys_Id = $2; $docstr = ""; ... (1 Reply)
Discussion started by: jaganadh
1 Replies

6. Shell Programming and Scripting

Convert / to \

Hi, In my input variable values are c:/test/sample/ I need to convert it to c:\test\sample I need to find and replace it How do I do it? var_conversion=`"$var_SearchFile" | sed 's/'\'/'/'/g'` echo ${var_conversion%/*} My code throws error (4 Replies)
Discussion started by: magesh_bala
4 Replies

7. Shell Programming and Scripting

Help with convert string

Hi. I will be very appreciated for help. I need replace all characters into string with \ (backslash) I mean if I have word abcdefg as input. How I can convert it to \a\b\c\d\e\f\g Thanks and best regards. Staas. (5 Replies)
Discussion started by: beckss
5 Replies

8. Shell Programming and Scripting

Convert to Integer

Hi fellows!! i'm doing something which is not working out for me properly which i don't understand why nowdate=`date +%s` echo $nowdate now the problem how to convert a date which is stored in a variable mydate="22/Oct/2011" mydate=`date -d '$mydate' +%s` it gives error... (11 Replies)
Discussion started by: me_newbie
11 Replies

9. Shell Programming and Scripting

how to convert from csh to sh

Dear all I am installing some eda software using script. My OS is ubuntu 10.04 and the eda software writing in csh. Since ubuntu reading script file in sh writting. I need someone can help me to convert some definition in script from csh to sh. Below is part of script set archinfo =... (3 Replies)
Discussion started by: tompham
3 Replies

10. UNIX for Dummies Questions & Answers


my file or content of the file looks like this: HR-BUSPARTNET SC-POINQUIRY BATCH FIN-CHOPDATARESTRICT HR-DATABASEACCESSNOEXEC GL-EXTINQ RSS SC-APPROVER ESS all said and done, i'd like to have it look like this: ... (6 Replies)
Discussion started by: lawsongeek
6 Replies
GETC(3S)																  GETC(3S)

getc, getchar, fgetc, getw - get character or word from stream SYNOPSIS
#include <stdio.h> int getc(stream) FILE *stream; int getchar() int fgetc(stream) FILE *stream; int getw(stream) FILE *stream; DESCRIPTION
Getc returns the next character from the named input stream. Getchar() is identical to getc(stdin). Fgetc behaves like getc, but is a genuine function, not a macro; it may be used to save object text. Getw returns the next word from the named input stream. It returns the constant EOF upon end of file or error, but since that is a good integer value, feof and ferror(3) should be used to check the success of getw. Getw assumes no special alignment in the file. SEE ALSO
fopen(3), putc(3), gets(3), scanf(3), fread(3), ungetc(3) DIAGNOSTICS
These functions return the integer constant EOF at end of file or upon read error. A stop with message, `Reading bad file', means an attempt has been made to read from a stream that has not been opened for reading by fopen. BUGS
The end-of-file return from getchar is incompatible with that in UNIX editions 1-6. Because it is implemented as a macro, getc treats a stream argument with side effects incorrectly. In particular, `getc(*f++);' doesn't work sensibly. GETC(3S)

Featured Tech Videos

All times are GMT -4. The time now is 03:26 PM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy