Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #98731

Re: Program to create csv file and write into it

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Program to create csv file and write into it
Date Sat, 10 Dec 2016 20:42:13 +0000
Organization A noiseless patient Spider
Lines 46
Message-ID <87wpf71pp6.fsf@bsb.me.uk> (permalink)
References <6b201709-fae0-4a06-9783-af485e4040bf@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="37d39f1a58f57a5f3133891d23ed2dca"; logging-data="4943"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+t6IWv0sBqDg8dzVYu4vpZB1s1O6XMS+w="
Cancel-Lock sha1:T5E4rzReAs1K3b6mxX15xcZ51nw= sha1:CRqYv6FIBisCQa+KuQ8AuZMwXg8=
X-BSB-Auth 1.5d51c30fa76ed75453a6.20161210204213GMT.87wpf71pp6.fsf@bsb.me.uk
Xref csiph.com comp.lang.c:98731

Show key headers only | View raw


Alla _ <modelling.data@gmail.com> writes:

> I have learned a lot (I understand that it's a lot for me but nothing
> for majority of you :) ) during these days thanks to great help I have
> received here.
>
> Here is a corrected version of a program that:
> (1) creates an csv file
> (2) gets data from the user
> (3) writes the received data into a file
>
> I have tested it with the following input:
>
> Enter account number ( 1 to 3, 0 to end input )
> ? 89
> Enter lastname, firstname, balance
> ? Brown James 109
> Enter account number
> ? 4
> Enter lastname, firstname, balance
> ? Hampton Kira 67
> Enter account number
> ? 1        
> Enter lastname, firstname, balance
> ? Ritz Rob 200
> Enter account number
> ? 0
>
> and..... I got a correct csv file )))))))))))))))))))))) Sorry for all
> these smiles, but that's how I feel now )

Sorry to be the bearer of bad news, but that's not a CSV file.  A CSV
file is a text file and would not contain all those nulls.  The records
would simply be contiguous lines.

I'm not sure if you can see all the nulls, so to start you should find
something like a hex dump program and learn to read what its output
means.  If you are, as it seems, going to be writing binary
random-access files, you will need a hex dump program.

I won't comment on the code in detail because I don't know what you want
to write -- a binary random-access data file or a text-based CSV one.

<snip>
-- 
Ben.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-10 09:30 -0800
  Re: Program to create csv file and write into it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 20:42 +0000
    Re: Program to create csv file and write into it Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2016-12-10 15:56 -0500
      Re: Program to create csv file and write into it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 21:08 +0000
    Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-10 23:48 -0800
      Re: Program to create csv file and write into it Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-11 00:01 -0800
      Re: Program to create csv file and write into it Keith Thompson <kst-u@mib.org> - 2016-12-11 01:12 -0800
      Re: Program to create csv file and write into it Keith Thompson <kst-u@mib.org> - 2016-12-11 01:27 -0800
        Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-11 04:50 -0800
          Re: Program to create csv file and write into it Barry Schwarz <schwarzb@dqel.com> - 2016-12-11 09:42 -0800
            Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-12 00:13 -0800
              Re: Program to create csv file and write into it Richard Heathfield <rjh@cpax.org.uk> - 2016-12-12 08:34 +0000
                Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-12 00:50 -0800
                Re: Program to create csv file and write into it Richard Heathfield <rjh@cpax.org.uk> - 2016-12-12 09:02 +0000
                Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-12 02:52 -0800
                Re: Program to create csv file and write into it Richard Heathfield <rjh@cpax.org.uk> - 2016-12-12 10:59 +0000
                Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-12 03:23 -0800
          Re: Program to create csv file and write into it mx2927 <mx2927@gmail.com> - 2016-12-11 20:44 +0100
            Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-11 23:57 -0800
              Re: Program to create csv file and write into it Barry Schwarz <schwarzb@dqel.com> - 2016-12-12 01:06 -0800
      Re: Program to create csv file and write into it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 11:39 +0000
        Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-11 04:47 -0800
          Re: Program to create csv file and write into it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 14:43 +0000
            Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-12 00:56 -0800
      Re: Program to create csv file and write into it Barry Schwarz <schwarzb@dqel.com> - 2016-12-11 09:38 -0800
        Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-12 00:44 -0800
          Re: Program to create csv file and write into it Richard Heathfield <rjh@cpax.org.uk> - 2016-12-12 08:48 +0000
          Re: Program to create csv file and write into it Barry Schwarz <schwarzb@dqel.com> - 2016-12-12 01:19 -0800
            Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-12 02:30 -0800
            Re: Program to create csv file and write into it Manfred <noname@invalid.add> - 2016-12-12 15:10 +0100
              Re: Program to create csv file and write into it Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-12 12:35 -0800
  Re: Program to create csv file and write into it Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-10 14:29 -0800
    Re: Program to create csv file and write into it Alla _ <modelling.data@gmail.com> - 2016-12-10 23:57 -0800
      Re: Program to create csv file and write into it Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-11 00:33 -0800
        Re: Program to create csv file and write into it Keith Thompson <kst-u@mib.org> - 2016-12-11 01:19 -0800

csiph-web