FILE to String data types


 
Thread Tools Search this Thread
Top Forums Programming FILE to String data types
# 1  
Old 12-01-2006
Question FILE to String data types

Hi,
I am trying to read a FILE data type into a String data type, I tried to make the FILE* veriable just equal the String veriable but i get:
Code:
Conversion from 'FILE*' to 'String' is ambiguous

Has anyone got any idea?

Thanks
# 2  
Old 12-01-2006
It seems like you are starting out in C. If you explain exactly what you need to do, we can help. Showing what you think works is not going to help us at all. ...I'm guessing this has to do with your other post.
# 3  
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.
# 4  
Old 12-01-2006
Basically i have a fork and a execl i need to send the output of the execl instead of onto the screen, into a variable. I need to do this as the need to send it over a socket.
# 5  
Old 12-01-2006
dup allows you to close the fd for stdout, then redirect it to your socket fd.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question