GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-Jul-2015, 09:10
Line's Avatar
Line Line is offline
New Member
 
Join Date: Jul 2015
Posts: 1
Line is on a distinguished road

Analog of file_get_contents function?


Hello all!
I'm newbie in C. I have experience only with PHP.

Is there something like PHP-file_get_contents function?

Thanx
  #2  
Old 25-Jul-2015, 16:19
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,511
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Analog of file_get_contents function?


Well, not exactly as nice as PHP's function, but you could do something like this

Note, though, in that example [and others], that freeing the allocated memory is missing, so don't forget that step!

Also, handling large files, such as 2G+ could be an issue. I'm not sure how the PHP function handles the large file size situation? The PHP docs don't have any specific mention on limitation, but this doesn't mean that it's unlimited.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
Last edited by TurboPT : 25-Jul-2015 at 17:24.
  #3  
Old 27-Oct-2015, 01:01
lindseynicole lindseynicole is offline
New Member
 
Join Date: Oct 2015
Posts: 13
lindseynicole has a little shameless behaviour in the past

Re: Analog of file_get_contents function?


<?php
echo file_get_contents("test.txt");
?>
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
state machine to simulate a vending machine at each state of vending process 1stFallen C Programming Language 3 18-Mar-2013 18:56
Recursive function for "vowels", Recursive function for "sum of array" srikantk07 C++ Forum 1 19-Feb-2013 05:00
Call of function in C shikha C Programming Language 2 11-Oct-2012 08:33
NetBeans - Inventory Program biglez123 Java Forum 1 23-Jan-2011 20:48
Deleting elements of arrays C++ the_crazyman C++ Forum 25 30-May-2008 07:27

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:38.


vBulletin, Copyright © 2000 - 2017, Jelsoft Enterprises Ltd.