Sponsored Content
Full Discussion: FILE to String data types
Top Forums Programming FILE to String data types Post 302098279 by Corona688 on Friday 1st of December 2006 05:59:15 PM
Old 12-01-2006
stdio is not C++, just C. stdio does not have these gee-whiz overloading things that convert = into whatever the programmer thinks it ought to be. In trying to put a FILE * into a string you're trying to put the file pointer itself into a string, not the file contents. To access data with a FILE *, you MUST use the stdio functions.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

concatenating static string to records in data file

I just need to add a static ID to each output record so the users will be able to tell which group records in combined flatfiles come from I have the static ID in a bourne variable. I tried awk '{print "${GroupID}" $0}' infile > outfile But I ended up with the string ${GroupID} instead of... (5 Replies)
Discussion started by: gillbates
5 Replies

2. UNIX for Dummies Questions & Answers

How do I delete a data string from a .dat file in unix

I have a .dat file in unix and it keeps failing file validation on line x. How do I delete a data string from a .dat file in UNIX? I tried the following: sed -e 'data string' -e file name and it telling me unrecognized command (4 Replies)
Discussion started by: supergirl3954
4 Replies

3. UNIX for Dummies Questions & Answers

get the data in a file into single string

Hello everyone ! I need to get the data in a file into a string. file1 1 2 3 4 5 I need to write a script where the file1 info is stored in a string (say variable s). So the output should be 1,2,3,4,5 or (1,2,3,4,5) If i say echo $s or print $s output should be 1,2,3,4,5 or ... (7 Replies)
Discussion started by: i.scientist
7 Replies

4. Shell Programming and Scripting

Data after a string in a file

Hi, I have a file with data as follows: 324dsadfasfgf23<xmlsssssssssssssssssssssssssssssssssssssss<fdf>dfsdf> i need all the data followed by the string <xml? Is it possible to retrieve it? (1 Reply)
Discussion started by: Vijay06
1 Replies

5. Shell Programming and Scripting

How to concatenate a string in every row data of a file??

Please look into the example. My source file is like, 00,57,3,2008-07-24 06:30:06 10,1,8025171,"1M00",17907023,2008-07-23 18:16:58 10,2,8025171,"1M00",17907023,2008-07-23 18:17:01 99,184 What should i do if i want output like... hello,00,57,3,2008-07-24 06:30:06... (7 Replies)
Discussion started by: pkumar3
7 Replies

6. Shell Programming and Scripting

Searching a particular string with spaces in a data file

Hi, I'm new to shell scripting and require your help in achieving the requirement. I have a data file which stores organization name as one of the column data in a csv data file. Organization name stored in data file is: Canadian OU CAD Sample Data file: 1,5,4,5,, ... (9 Replies)
Discussion started by: andy4013
9 Replies

7. Shell Programming and Scripting

Help - Bug: A script to compile two types of data files into two temporary files

Dear other forum members, I'm writing a script for my homework, but I'm scratching all over my head and still can't figure out what I did wrong. Please help me. I just started to learn about bash scripting, and I appreciate if anyone of you can point out my errors. I thank you in advance. ... (3 Replies)
Discussion started by: ilove2smoke
3 Replies

8. Programming

Compute upper and lower limit of data types.

hello all, am stuck with ?. how to compute limits of char, int, float. i have done it simply displaying values from <limits.h> but i wan to calculate it.. its absolutley not a homework. thank you. (7 Replies)
Discussion started by: zius_oram
7 Replies

9. Shell Programming and Scripting

How to read all data after a specific string from a text file ?

Hi, I have a file(input.txt) and trying to format as output.txt. See the attached file format. Note: This is a windows file (DOS format) and the commands are also going to execute on windows. Basically I am trying to capture all the data in between Local Group Memberships and Global Group... (10 Replies)
Discussion started by: Monoj2014
10 Replies

10. Shell Programming and Scripting

Match string in two files and add data to one file

Gents, file1 S 65733.00 19793.00 1 0 318592.8 2792489.5 29.1063000008 S 65733.00 19801.00 1 0 323120.8 2789153.6 13.3063000044 S 66009.00 19713.00 1 0 318672.7 2792538.2 30.6063000120 S 65801.00 19799.00 1 ... (2 Replies)
Discussion started by: jiam912
2 Replies
__fbufsize(3C)						   Standard C Library Functions 					    __fbufsize(3C)

NAME
__fbufsize, __flbf, __fpending, __fpurge, __freadable, __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf - interfaces to stdio FILE structure SYNOPSIS
#include <stdio.h> #include <stdio_ext.h> size_t __fbufsiz(FILE *stream); int __flbf(FILE *stream); size_t __fpending(FILE *stream); void __fpurge(FILE *stream); int __freadable(FILE *stream); int __freading(FILE *stream); int __fsetlocking(FILE *stream, int type); int __fwritable(FILE *stream); int __fwriting(FILE *stream); void _flushlbf(void); DESCRIPTION
These functions provide portable access to the members of the stdio(3C) FILE structure. The __fbufsize() function returns in bytes the size of the buffer currently in use by the given stream. The __flbf() function returns non-zero if the stream is line-buffered. The __fpending function returns in bytes the amount of output pending on a stream. The __fpurge() function discards any pending buffered I/O on the stream. The __freadable() function returns non-zero if it is possible to read from a stream. The __freading() function returns non-zero if the file is open readonly, or if the last operation on the stream was a read operation such as fread(3C) or fgetc(3C). Otherwise it returns 0. The __fsetlocking() function allows the type of locking performed by stdio on a given stream to be controlled by the programmer. If type is FSETLOCKING_INTERNAL, stdio performs implicit locking around every operation on the given stream. This is the default system behavior on that stream. If type is FSETLOCKING_BYCALLER, stdio assumes that the caller is responsible for maintaining the integrity of the stream in the face of access by multiple threads. If there is only one thread accessing the stream, nothing further needs to be done. If multiple threads are accessing the stream, then the caller can use the flockfile(), funlockfile(), and ftrylockfile() functions described on the flockfile(3C) manual page to provide the appropriate locking. In both this and the case where type is FSETLOCKING_INTERNAL, __fsetlocking() returns the previous state of the stream. If type is FSETLOCKING_QUERY, __fsetlocking() returns the current state of the stream without changing it. The __fwritable() function returns non-zero if it is possible to write on a stream. The __fwriting() function returns non-zero if the file is open write-only or append-only, or if the last operation on the stream was a write operation such as fwrite(3C) or fputc(3C). Otherwise it returns 0. The _flushlbf() function flushes all line-buffered files. It is used when reading from a line-buffered file. USAGE
Although the contents of the stdio FILE structure have always been private to the stdio implementation, some applications have needed to obtain information about a stdio stream that was not accessible through a supported interface. These applications have resorted to access- ing fields of the FILE structure directly, rendering them possibly non-portable to new implementations of stdio, or more likely, preventing enhancements to stdio that would cause those applications to break. In the 64-bit environment, the FILE structure is opaque. The functions described here are provided as a means of obtaining the information that up to now has been retrieved directly from the FILE structure. Because they are based on the needs of existing applications (such as mh and emacs), they may be extended as other programs are ported. Although they may still be non-portable to other operating systems, they will be compatible from each Solaris release to the next. Interfaces that are more portable are under development. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |__fsetlocking() is Unsafe; | | |all others are MT-Safe | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
fgetc(3C), flockfile(3C), fputc(3C), fread(3C), fwrite(3C), stdio(3C), attributes(5) SunOS 5.10 5 Feb 1998 __fbufsize(3C)
All times are GMT -4. The time now is 01:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy