Sponsored Content
Top Forums Programming Copying a file and reading size I get always zero. Post 302985534 by Don Cragun on Friday 11th of November 2016 03:04:59 AM
Old 11-11-2016
Why don't you show us the whole source file? And, it wouldn't hurt to tell us what language you're using (one might assume it is C, but with all of the missing pieces needed for a valid C program, that is just a seemingly reasonable guess). And, show us what diagnostics were printed when you tried to compile your source code.

With what you have shown us there are lots of undefined values and undeclared functions without even considering that there is no main() function in your code.

Having code that says // Process error to handle errors, is a great way to ignore errors and have absolutely no idea whether or not anything worked. I would suggest that you actually put code in that section to issue a diagnostic if the rename() failed. And add checks to verify that the strcpy() and stat() calls also worked or print diagnostics and exit if any of them failed.

One might also note that you said your code is intended to copy of file. It does not copy a file. It attempts to move a file (removing the source file if the rename() succeeds); not copy it.
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Strange difference in file size when copying LARGE file..

Hi, Im trying to take a database backup. one of the files is 26 GB. I am using cp -pr to create a backup copy of the database. after the copying is complete, if i do du -hrs on the folders i saw a difference of 2GB. The weird fact is that the BACKUP folder was 2 GB more than the original one! ... (1 Reply)
Discussion started by: 0ktalmagik
1 Replies

2. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies

3. Shell Programming and Scripting

URGENT HELP NEEDED ON -File size reading

All Expert, I am using Sun OS 5.8 and Perl version 5 in One server and Perl 5.8 in another unix server. I am able to read a file using fopen function of perl --file size having more then 3 GB of data.(In the machine where Perl 5.8 install) But when i am running the same perl script --It... (1 Reply)
Discussion started by: jambesh
1 Replies

4. Programming

Reading a whole line without betting on size

i have been googling, and came to the conclusion that there is not standard C library (or commonly used) that reads a complete line of a file, without a size parameter being involved. so, as a little exercise i decided to think it over, and make my own i came up with an idea, and wanted to... (2 Replies)
Discussion started by: broli
2 Replies

5. Solaris

Directory size larger than file system size?

Hi, We currently have an Oracle database running and it is creating lots of processes in the /proc directory that are 1000M in size. The size of the /proc directory is now reading 26T. How can this be if the root file system is only 13GB? I have seen this before we an Oracle temp file... (6 Replies)
Discussion started by: sparcman
6 Replies

6. Shell Programming and Scripting

The scripts not able to make the file to size 0, every times it go back to its original size

#!/bin/sh ########################################################################################################## #This script is being used for AOK application for cleaning up the .out files and zip it under logs directory. # IBM # Created #For pdocap201/pdoca202 .out files for AOK #1.... (0 Replies)
Discussion started by: mridul10_crj
0 Replies

7. Shell Programming and Scripting

Script to read file size and send email only if size > 0.

Hi Experts, I have a script like $ORACLE_HOME/bin/sqlplus username/password # << ENDSQL set pagesize 0 trim on feedback off verify off echo off newp none timing off set serveroutput on set heading off spool Schemaerrtmp.txt select ' TIMESTAMP COMPUTER NAME ... (5 Replies)
Discussion started by: welldone
5 Replies

8. Programming

[c] How to calculate size of the file from size of the buffer?

Hi, Can I find size of the file from size of the buffer written? nbECRITS = fwrite(strstr(data->buffer, ";") + 1, sizeof(char), (data->buffsize) - LEN_NOM_FIC, fic_sortie); Thank You :) (1 Reply)
Discussion started by: ezee
1 Replies

9. UNIX for Dummies Questions & Answers

Ls directory size reporting byte size instead of file count

I have been searching both on Unix.com and Google and have not been able to find the answer to my question. I think it is partly because I can't come up with the right search terms. Recently, my virtual server switched storage devices and I think the problem may be related to that change.... (2 Replies)
Discussion started by: jmgibby
2 Replies

10. UNIX for Beginners Questions & Answers

Reading and copying a selected rows

Dear All, I have a data file input.res like below. (Only six column shown here for example.) Sequence of first column starting from 1 to 148. Input file 1 Q0 9_August_2014_Entertainment2 0 20.14967806339729 BM25b1.0 1 Q0 13_October_2012_Page323 1 20.134224346765738 BM25b1.0 1 Q0... (2 Replies)
Discussion started by: imranrasheedamu
2 Replies
PI(1)							      General Commands Manual							     PI(1)

NAME
pi - Pascal interpreter code translator SYNOPSIS
pi [ -blnpstuwz ] [ -i name ... ] name.p DESCRIPTION
Pi translates the program in the file name.p leaving interpreter code in the file obj in the current directory. The interpreter code can be executed using px. Pix performs the functions of pi and px for `load and go' Pascal. The following flags are interpreted by pi; the associated options can also be controlled in comments within the program as described in the Berkeley Pascal User's Manual. -b Block buffer the file output. -i Enable the listing for any specified procedures and functions and while processing any specified include files. -l Make a program listing during translation. -n Begin each listed include file on a new page with a banner line. -p Suppress the post-mortem control flow backtrace if an error occurs; suppress statement limit counting. -s Accept standard Pascal only; non-standard constructs cause warning diagnostics. -t Suppress runtime tests of subrange variables and treat assert statements as comments. -u Card image mode; only the first 72 characters of input lines are used. -w Suppress warning diagnostics. -z Allow execution profiling with pxp by generating statement counters, and arranging for the creation of the profile data file pmon.out when the resulting object is executed. FILES
file.p input file file.i include file(s) /usr/share/pascal/pi_stringstext of the error messages /usr/share/pascal/how_pi*basic usage explanation obj interpreter code output SEE ALSO
Berkeley Pascal User's Manual pcc(1), pix(1), px(1), pxp(1), pxref(1) DIAGNOSTICS
For a basic explanation do pi In the diagnostic output of the translator, lines containing syntax errors are listed with a flag indicating the point of error. Diagnos- tic messages indicate the action which the recovery mechanism took in order to be able to continue parsing. Some diagnostics indicate only that the input is `malformed.' This occurs if the recovery can find no simple correction to make the input syntactically valid. Semantic error diagnostics indicate a line in the source text near the point of error. Some errors evoke more than one diagnostic to help pinpoint the error; the follow-up messages begin with an ellipsis `...'. The first character of each error message indicates its class: EFatal error; no code will be generated. eNon-fatal error. wWarning - a potential problem. sNon-standard Pascal construct warning. If a severe error occurs which inhibits further processing, the translator will give a diagnostic and then `QUIT'. AUTHORS
Charles B. Haley, William N. Joy, and Ken Thompson BUGS
Formal parameters which are procedures and functions are not supported. The keyword packed and the function dispose are recognized but have no effect. For clarity, semantic errors should be flagged at an appropriate place in the source text, and multiple instances of the `same' semantic error should be summarized at the end of a procedure or function rather than evoking many diagnostics. When include files are present, diagnostics relating to the last procedure in one file may appear after the beginning of the listing of the next. 3rd Berkeley Distribution PI(1)
All times are GMT -4. The time now is 05:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy