Sponsored Content
Top Forums Programming Not getting O/P in expected way-java Post 303018140 by RudiC on Wednesday 30th of May 2018 04:08:48 AM
Old 05-30-2018
You're doing two things here: you are writing several constants and variables to a temp file, without a <new line> character, and close that file. Then, you read that file, print it to screen / terminal including a <new line>, and add another string constant with <new line>.


No surprise the <new line> is missing when you cat the temp file to screen.
 

We Also Found This Discussion For You

1. Programming

Java not getting in expected way

Hi i am new to java and written a below code on linux platform which is working fine but not getting the output on terminal as expected vi A.java import java.io.FileOutputStream; class A { public static void main (String args) { byte c= {'a','e','i','o','u'}; try {... (1 Reply)
Discussion started by: scriptor
1 Replies
TMPFILE(3)								 1								TMPFILE(3)

tmpfile - Creates a temporary file

SYNOPSIS
resource tmpfile (void ) DESCRIPTION
Creates a temporary file with a unique name in read-write (w+) mode and returns a file handle . The file is automatically removed when closed (for example, by calling fclose(3), or when there are no remaining references to the file handle returned by tmpfile(3)), or when the script ends. For details, consult your system documentation on the tmpfile(3) function, as well as the stdio.h header file. RETURN VALUES
Returns a file handle, similar to the one returned by fopen(3), for the new file or FALSE on failure. EXAMPLES
Example #1 tmpfile(3) example <?php $temp = tmpfile(); fwrite($temp, "writing to tempfile"); fseek($temp, 0); echo fread($temp, 1024); fclose($temp); // this removes the file ?> The above example will output: writing to tempfile SEE ALSO
tempnam(3), sys_get_temp_dir(3). PHP Documentation Group TMPFILE(3)
All times are GMT -4. The time now is 12:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy