Help: Hwo to write double quotation marks ("") into a text file using function asciiwrite?

From: lxf <heaven_bird334_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 21 2011 - 08:44:13 MDT

Dear All,
       I met a proplem in writing strings into a file. The sting I want to output stings into a file, but didn't succeed because the double quotation marks ("") in the string can't be defined. The strings is a line like this:

                 step => "0",

       So, my ncl scripts is as following:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
   lines = new(22,string)
   lines(0) = "step => "0","
   asciiwrite ("foo", lines)

    And the wrong informations is as following:
>ncl -x t.ncl
 Copyright (C) 1995-2010 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 5.2.1
 The use of this software is governed by a License Agreement.
 See for more details.
Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
+ begin
+ lines = new(22,string)
fatal:syntax error: line 7 in file t.ncl before or near 0
   lines(0) = "step => "0

+ lines(0) = "step => "0","
+ asciiwrite ("foo", lines)
+ end
fatal:Syntax Error in block, block not executed
fatal:error at line 9 in file t.ncl

      Any help or suggestion is appriciatble.
      Have a good day!


ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Thu Apr 21 08:45:17 2011

This archive was generated by hypermail 2.1.8 : Tue May 03 2011 - 14:47:35 MDT