i tried using fwrite($outfile,"\040) to insert a 'space' char and fwrite($outfile,"\t" for a 'tab' char but they don't seem to work. how then do i insert a 'space' or a 'tab' character to a file?
permission looks ok, i can open (read/write) it without errors.
i'm thinking by now of other alogorithm. i'm thinking of using the file function to read the content of the $infile then do the manipulation with the result array and then save changes to the $outfile. what do you think?
has anyone here created some sort of utility for converting csv file to fixed-width format?
hope you could share your thoughts, algorithm, whatever that might help me with this....
I generally recommend against reading an entire file into memory if you are going to manipulate it row-by-row. A sufficiently large input file could cause your code to exceed resource limits.
I would read in the CSV line by line, split it at whatever the field terminator is, then use concatentation and substrings to output fixed-width data to the output file.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.