Sponsored Content
Top Forums Programming Help to filter read through reference file by using c language Post 302541701 by Corona688 on Monday 25th of July 2011 11:00:43 AM
Old 07-25-2011
Quote:
Originally Posted by yazu
3. You need strings, not char buffers, so after reading add '\0' to the end of string (you should remember the value from fgets - use auxiliary variable).
If fgets didn't null-terminate for you, how could you possibly know where the NULL belongs? fgets terminates for you, like most string functions.
These 2 Users Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Read from a file then filter the output

Hi i need a script which reads a certain file and then display it on the screen. The thing is i need to filter the display output. this is an example of the file which is to be loaded in the script. asdfg1.1.1|98 hjkldfe4.0.3|123 asdzxzvdweradfsdafascv10.0.10|123456789... (1 Reply)
Discussion started by: khestoi
1 Replies

2. Programming

How to read the CTS and DSR of RS232 in Unix using C language?

Hello to all Gurus out there, Could you show me a source code in Unix platform using C language. I want to read the status or voltage level of the DSR and CTS. Thanks a lot, Swing5 (2 Replies)
Discussion started by: Swing5
2 Replies

3. Shell Programming and Scripting

Shell script to read lines in a text file and filter user data

hi all, I have this file with some user data. example: $cat myfile.txt FName|LName|Gender|Company|Branch|Bday|Salary|Age aaaa|bbbb|male|cccc|dddd|19900814|15000|20| eeee|asdg|male|gggg|ksgu|19911216||| aara|bdbm|male|kkkk|acke|19931018||23| asad|kfjg|male|kkkc|gkgg|19921213|14000|24|... (4 Replies)
Discussion started by: srimal
4 Replies

4. UNIX for Dummies Questions & Answers

awk language reference: book

Gurus, I am looking for a book on Awk programming. A quick Google search gave me Amazon.com: The AWK Programming Language (9780201079814): Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger: Books by Alfred Aho. Is there anything other than that? Any advice? Thanks. Al. (1 Reply)
Discussion started by: alan
1 Replies

5. Ubuntu

Any way we can create an SMTP server and use any scripting language to read emails from that server

Is there any way to create an SMTP mail server will all granular permissions to it so that I can read emails which that server receives through any scripting language and also reply from the same server automatically? (3 Replies)
Discussion started by: sandeepcm
3 Replies

6. Shell Programming and Scripting

Perl de-reference code reference variable

Guys, May i know how can we de reference the code reference variable.? my $a = sub{$a=shift;$b=shift;print "SUM:",($a+$b),"\n";}; print $a->(4,5); How can we print the whole function ? Please suggest me regarding this. Thanks for your time :) Cheers, Ranga :) (0 Replies)
Discussion started by: rangarasan
0 Replies

7. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

8. UNIX for Dummies Questions & Answers

Filter records in a huge text file from a filter text file

Hi Folks, I have a text file with lots of rows with duplicates in the first column, i want to filter out records based on filter columns in a different filter text file. bash scripting is what i need. Data.txt Name OrderID Quantity Sam 123 300 Jay 342 498 Kev 78 2500 Sam 420 50 Vic 10... (3 Replies)
Discussion started by: tech_frk
3 Replies

9. Shell Programming and Scripting

Keeping record of file 2 based on a reference file 1 in awk

I have 2 input files (tab separated): file1: make_A 1990 foo bar make_B 2010 this that make_C 2004 these those file2: make_X 1970 1995 ref_1:43 ref_2:65 make_A 1970 1995 ref_1:4 ref_2:21 ref_3:18 make_A 1980 2002 ref_1:7 ref_2:7 ref_3:0 ... (2 Replies)
Discussion started by: beca123456
2 Replies

10. UNIX for Dummies Questions & Answers

awk to replace values in one file using a second reference file

Hi, I'd be grateful for your help with the following: I have a file with a single column (file1). Let's say the values are: a b c 5 d I have a second, reference file (ref_file), which is colon-delimited, and is effectively a key. Let's say the values in it are: a:1 b:2 c:3 d:4... (4 Replies)
Discussion started by: aberg
4 Replies
explain_fgets_or_die(3) 				     Library Functions Manual					   explain_fgets_or_die(3)

NAME
explain_fgets_or_die - input of strings and report errors SYNOPSIS
#include <libexplain/fgets.h> char *explain_fgets_or_die(char *data, int data_size, FILE *fp); DESCRIPTION
The explain_fgets_or_die function is used to call the fgets(3) system call. On failure an explanation will be printed to stderr, obtained from explain_fgets(3), and then the process terminates by calling exit(EXIT_FAILURE). This function is intended to be used in a fashion similar to the following example: explain_fgets_or_die(data, data_size, fp); data The data, exactly as to be passed to the fgets(3) system call. data_size The data_size, exactly as to be passed to the fgets(3) system call. fp The fp, exactly as to be passed to the fgets(3) system call. Returns: This function only returns on success; data when a line is read, or NULL on end-of-file. On failure, prints an explanation and exits. SEE ALSO
fgets(3) input of strings explain_fgets(3) explain fgets(3) errors exit(2) terminate the calling process COPYRIGHT
libexplain version 0.52 Copyright (C) 2008 Peter Miller explain_fgets_or_die(3)
All times are GMT -4. The time now is 05:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy