Talk:Append a record to the end of a text file: Difference between revisions

→‎Confused: new section
(→‎CSV?: Looks like something that's not what people call "CSV")
(→‎Confused: new section)
Line 25:
value21,value22,value23,value24 with spaces
::Commas are the only separator. The colons in the given format make it look like something else that we shouldn't call CSV. Is that what etc/passwd looks like? It would probably be best to say something like "the record's values are separated by commas, with values in composite items separated by commas (similar to Linux's /etc/passwd file)." If at all possible you might want to make the data structures involved in the record very very simple (i.e. no structs). That would make sure the focus is on what's in the task title. Stringifying a custom data structure is a different task (which we might not have yet...). --[[User:Mwn3d|Mwn3d]] 02:23, 13 September 2011 (UTC)
 
== Confused ==
 
Currently, the initial password file contents are specified as:
 
{|class="wikitable" style="text-align: center; margin: 1em auto 1em auto;"
|+ Source record field types and contents.
|-
!account||password||UID||GID||fullname,office,extension,homephone,email||directory||shell
|-
!string||string||int||int||struct(string,string,string,string,string)||string||string
|-
|jsmith||x||1001||1000||Joe Smith,Room 1007,(234)555-8917,(234)555-0077||jsmith@rosettacode.org||/home/jsmith
|-
|jdoe||x||1002||1000||Jane Doe,Room 1004,(234)555-8914,(234)555-0044||jdoe@rosettacode.org||/home/jsmith
|}
 
But this conflicts with the [http://www.cyberciti.biz/faq/understanding-etcpasswd-file-format/ usual password file format]
 
Specifically the sixth field is supposed to be the home directory, and not an email address. Email address goes in the fifth field. And the seventh field is supposed to be the user's shell, and not their home directory. Also, two users with different user ids should not share the same home directory
 
So I think the initial contents should have been specified as:
 
{|class="wikitable" style="text-align: center; margin: 1em auto 1em auto;"
|+ Source record field types and contents.
|-
!account||password||UID||GID||fullname,office,extension,homephone,email||directory||shell
|-
!string||string||int||int||struct(string,string,string,string,string)||string||string
|-
|jsmith||x||1001||1000||Joe Smith,Room 1007,(234)555-8917,(234)555-0077,jsmith@rosettacode.org||/home/jsmith||/bin/bash
|-
|jdoe||x||1002||1000||Jane Doe,Room 1004,(234)555-8914,(234)555-0044,jdoe@rosettacode.org||/home/jdoe||/bin/bash
|}
 
Something similar applies for the appended record. --[[User:Rdm|Rdm]] 02:26, 13 September 2011 (UTC)
6,962

edits