I am going through an example for a class and ran into something that is not working for me the same way as it did for the professor when he demonstrated it.
Its a part of an "ls" program, and this is for formatting the data output. maxlen is the number of characters in the name of the longest named file or directory.Code:printf(%*s %10ld\n", -maxlen,file,buf.st_size);
On his it aligns neatly to the left, but when I compile and execute it on mine it does not provide formatting for the string. File is a String pointer to the filename and de is a structure that holds metadata about the file or directory.
Id like to know what I could be doing wrong as I like the idea of being able to format the column width with a variable instead of hard coded. Thanks for any help.