Text file to be exactly 324 characters

Hi experts
When I fill my string of values and there are only 250 characters, I would fill the remaining 74 characters with blanks.
I mean that when you later open the text file there should be 324 characters, whether there are values or not.
How I do that?
Thanks  //  Peter B

Hi Peter
You can define a variable with length 324  and move file value to this variable. So it the value contains or not 324 characters it will be filled with 324 positions or blank positions.
DATA:
   x_var(324) TYPE c.
OPEN DATASET myfile FOR INPUT IN TEXT MODE.
READ DATASET myfile TO x_var
CLOSE DATASET myfile
I hope ity helps
Carlos Machado

Similar Messages

  • Read from Text File.vi adds spaces between characters

    I'm openning a text file in LabVIEW, and and need to parse some information from it.  However, when I open the file, there are extra spaces between the letters.  When I just open the same file with Notepad or Wordpad, the spaces are not there.  Is there a way to eliminate this problem?

    And, since after the \FF\FE, every other character is \00, you can even do a homebrew quick&dirty solution.
    Are the files always like that, or are some "normal"?
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    readspecialfile.png ‏12 KB

  • Opening Text File.

    my text is file is getting updated every second, how can i access that updated data from the text file using java. It is just that i am getting some data from an encoder, the encoder is going to put the data into a text file and it is going to update data in some time interval. I just wanna be able access that updated data and display onto the screen until no new data is put in the text file.

    Not sure exactly. But something you could try:
    use a FileReader object to read characters in until there are no more. Then sleep the thread(probably not the event dispatch thread.., so have a seperate thread that can wait) for some amount of time(like a second) so whatever is writing to the file has time to write... Now if the FileReader isnt detecting that the the file is being written to, then you will need to halt when you are done reading. then close the reader recreate it and skip all the characters that you have read in the previous try. meaning you'll have to keep track of how many chars you've read.

  • Text File in SO_NEW_DOCUMENT_ATT_SEND_API1

    Hello!
    We're using SO_NEW_DOCUMENT_ATT_SEND_API1 to send txt files attached to an e-mail.
    My problem is that whenever a text file with less than 500 characters is attached to e-mail, the last line of this text file is filled with many blank characters (spaces)
    I can only see this if I open the file by the e-mail, and I'm not able to see this blank line in debug.
    I think this is related to table CONTENTS_BIN, due to it's line size of char255, but i'm not 100% sure.
    Does any one knows how to solve this? We don't want that blank line at the end of the file.
    Mauricio

    Hi Mauricio,
    Did you pass xs_gd_doc_data and xt_packing_list in your FM
    Constant : lc_name    TYPE string VALUE 'Test Mail',
                 lc_descr   TYPE string VALUE 'Test Mail',
                 lc_f       TYPE c      VALUE 'F',
                 lc_zero    TYPE c      VALUE '0',
                 lc_one     TYPE c      VALUE '1',
                 lc_doctype TYPE string VALUE 'RAW'.
      CLEAR: lv_cnt.
    xy_message-line = lc_string.
      APPEND xyt_message.
      CONCATENATE lc_text_01 xv_premise INTO lv_message_premise SEPARATED BY space.
      xt_message-line = lv_message_premise.
      APPEND xt_message.
      CONCATENATE lc_text_02 xv_address INTO lv_message_address SEPARATED BY space.
      xt_message-line = lv_message_address.
      APPEND xt_message.
      CONCATENATE lc_text_03 xv_auszdat INTO lv_message_auszdat SEPARATED BY space.
      xt_message-line = lv_message_auszdat.
      APPEND xt_message.
      DESCRIBE TABLE xt_message LINES lv_cnt.
      xys_gd_doc_data-doc_size =
         ( lv_cnt - 1 ) * 255 + STRLEN( xt_message ).
      xys_gd_doc_data-obj_langu = sy-langu.
      xys_gd_doc_data-obj_name  = lc_name.
      xys_gd_doc_data-obj_descr = lc_descr.
      xys_gd_doc_data-sensitivty = lc_f.
      CLEAR xyt_packing_list.
      REFRESH xyt_packing_list.
      xyt_packing_list-transf_bin = space.
      xyt_packing_list-head_start = lc_one.
      xyt_packing_list-head_num = lc_zero.
      xyt_packing_list-body_start = lc_one.
      DESCRIBE TABLE xt_message LINES xyt_packing_list-body_num.
      xyt_packing_list-doc_type = lc_doctype.
      APPEND xyt_packing_list.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = xs_gd_doc_data
          put_in_outbox              = lc_true
          commit_work                = lc_true
        IMPORTING
          sent_to_all                = lv_sent_all
        TABLES
          packing_list               = xt_packing_list
          contents_txt               = xt_message
          receivers                  = xt_receivers
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
      IF sy-subrc <> 0.
    *Do Nothing
      ENDIF.
    Hope this resolve your query.
    Regards,
    Manish

  • Ipod is not adding text files??

    hi, i have had my ipod fifth generation from august 2010, and i just found out that i can add text files to it. now when i follow the instructions on it, and i see the files, none of the text shows up, and next to the title is .docx!! i really need help with this, any help would be greatly appreciated.

    Are these plain text files of less than 4096 characters or MS Word files?

  • Characters y and b appear when reading a text file

    The vi shown in the picture opens a text file from hard drive with "Open/Create/Replace File" and with "Read from Spreadsheet File".
    Then the vi displays the text in the respective indicators. 
    In both indicators, there is a y and b that appear as the very first first characters.
    It's not exactly a y and b. The y has two dots over it and the stem of the b hangs low, a non-English script. 
    In Word and Notepad these charcters don't show up. The first character is a zero as I originally wrote. 
    The text file was originally created in Excel and then saved as unicode text. 
    From whence do these funky letters come? and how do I get them to leave? 
    Also, it looks like the text in both indicators is adding a blank line after each line. That doesn't show up Notepad or Word either. 
     

    Carmen92126 wrote:
    The text file was originally created in Excel and then saved as unicode text.
    There's your problem: unicode.  You might want to check out this quick thread: Config file "byte order mark"
    Yes, by saving as Unicode, you have a couple of extra bytes that most text editor know to ignore.  But LabVIEW just gives you the raw data.

  • Reading characters from a text file into a multidimensional array?

    I have an array, maze[][] that is to be filled with characters from a text file. I've got most of the program worked out (i think) but can't test it because I am reading my file incorrectly. However, I'm running into major headaches with this part of the program.
    The text file looks like this: (It is meant to be a maze, 19 is the size of the maze(assumed to be square). is free space, # is block, s is start, x is finish)
    This didn't paste evenly, but thats not a big deal. Just giving an idea.
    19
    5..................
    And my constructor looks like follows, I've tried zillions of things with the input.hasNext() and hasNextLine() to no avail.
    Code:
    //Scanner to read file
    Scanner input = null;
    try{
    input = new Scanner(fileName);
    }catch(RuntimeException e) {
    System.err.println("Couldn't find the file");
    System.exit(0);
    //Set the size of the maze
    while(input.hasNextInt())
    size = input.nextInt();
    //Set Limits on coordinates
    Coordinates.setLimits(size);
    //Set the maze[][] array equal to this size
    maze = new char[size][size];
    //Fill the Array with maze values
    for(int i = 0; i < maze.length; i++)
    for(int x = 0; x < maze.length; x++)
    if(input.hasNextLine())
    String insert = input.nextLine();
    maze[i][x] = insert.charAt(x);
    Any advice would be loved =D

    Code-tags sometimes cause wonders, I replaced # with *, as the code tags interprets # as comment, which looks odd:
    ******...*.........To your code: Did you test it step by step, to find out about what is read? You could either use a debugger (e.g., if you have an IDE) or system outs to get a clue. First thing to check would be, if the maze size is read correctly. Further, the following loops look odd:for(int i = 0; i < maze.length; i++) {
        for(int x = 0; x < maze.length; x++) {
            if (input.hasNextLine()) {
                String insert = input.nextLine();
                maze[x] = insert.charAt(x);
    }Shouldn't the nextLine test and assignment be in the outer loop? And assignment be to each maze's inner array? Like so:for(int i = 0; i < maze.length; i++) {
        if (input.hasNextLine()) {
            String insert = input.nextLine();
            for(int x = 0; x < insert.size(); x++) {
                maze[i][x] = insert.charAt(x);
    }Otherwise, only one character per line is read and storing a character actually should fail.

  • How I can save an existed Table "exactly" into an Excel or a Text file?

    I am able to save from a Table into an Excel file, but I could not put in it the following:
    a)Column Headers
    b)First column should be integer
    c)The Scientific notation (supposed to be with 6 decimal point) but it shows only two decimal point
    d)In the last 3 rows, it couldn't understand --> it showed Zero's
    ***> It shows better when I changed the data.xls to data.txt ... only solved c)
    ***> You cam modify completely how to write into the Excel or Text file ... but do not change the way I write to the TABLE (I have "no choice" to keep it that way!)
    Attachments:
    Write_Table.vi ‏51 KB

    First of all, the Write to Spreadsheet File function does not create an Excel file. It creates a text file with values separated by a delimiter. Excel is capable of recognizing tabs and commas as delimiters and will convert the text into a spreadsheet.
    Most of your problems can be solved by converting Write to Spreadsheet to accept arrays of strings instead of arrays of numbers and adding the column headers to the array. You'll probably have to experiment with the Excel import function as well.
    Thye best way, however to get exactly what you want into Excel is to use ActiveX. There is an example the4 comes with LabVIEW that shows some of the basics. You can find other examples by searching the Developers Zone. NI also sells a toolkit for reading/
    writing Excel and Word files.

  • How to read characters from a text file in java program ?

    Sir,
    I have to read the characters m to z listed in a text file .
    I must compare the character read from the file.
    And if any of the characters between m to z is matched i have to replace it with a hexadecimal value.
    Any help or suggesstions in this regard would be very useful.
    Thanking you,
    khurram

    Hai,
    The requirement is like this
    There is an input file, the contents of the file are as follows, you can assume any name for the file.
    #Character mappings for Japanese Shift-JIS character set
    #ASCII character Mapped Shift-JIS character
    m 227,128,133 #Half width katakana letter small m
    n 227,128,134 #Half width katakana letter small n
    o 227,129,129
    p 227,129,130
    q 227,129,131
    r 227,129,132
    s 227,129,133
    t 227,129,134
    u 227,129,135
    v 227,129,136
    w 227,129,137
    x 227,129,138
    y 227,129,139
    z 227,129,142
    The contents of the above file are to be read as input.
    On encountering any character between m to z, i have to do a replacement with a hexadecimal code point value for the multibyte representation in the second column in the input file.
    I have the code to get the unicode codepoint value from the multibyte representation, but not from a file.
    So if you could please tell me how to get the characters in the second column, it would be very useful for me.
    The character # is used to represent the beginning of a comment in the input file.
    And comment lines are to be ignored while reading the file.
    Say i have a string str="message";
    then i should replace the m with the unicode code point value.
    Thanking you,
    khurram

  • Upload text files with non-english characters

    I use an Apex page to upload text files. Then i retrieve the contents of files from wwv_flow_files.blob_content and convert them to varchar2 with utl_raw.cast_to_varchar2, but characters like ò, à, ù become garbage.
    What could be the problem? Are characters lost when files are stored in wwv_flow_files or when i do the conversion?
    Some other info:
    * I see wwv_flow_files.DAD_CHARSET is set to "ascii", wwv_flow_files.FILE_CHARSET is null.
    * Trying utl_raw.cast_to_varchar2( utl_raw.cast_to_raw('àòèù') ) returns 'àòèù' correctly;
    * NLS_CHARACTERSET parameter is AL32UTF8 (not just english ASCII)

    Hi
    Have a look at csv upload -- suggestion needed with non-English character in csv file it might help you.
    Thanks,
    Manish

  • Printing the First 14 Characters of Every Line in a Text File

    My text file looks like the following:
    1111097116274, H0101C58F8110C005, 1, 16:48:03
    1111097116274, H0100058F8110C006, 2, 16:48:10
    1111097116274, H00F0458F8110C006, 3, 16:48:12I want my java program to print the first 14 characters of every line. Here's what I have:
    import java.awt.*;
    import javax.swing.JOptionPane;
    import java.io.*;
    public class Read {
         public static void main( String args[] ) {
        try {
            BufferedReader in = new BufferedReader(new FileReader("aFile.txt"));
            String line;;
            /*String tagid;*/
            while ((line = in.readLine()) != null) {
                 char[] tagid = line.toCharArray();
                 line.getChars(0, 14, tagid, 0); 
                 System.out.println(tagid);
            in.close();
        } catch (IOException e) {
             JOptionPane.showMessageDialog( null, "Error" );
             System.exit(0);
         Instead of printing the first 14 characters of every line to output, it prints the whole text file.
    Any ideas of what's wrong?
    Thanks.

    Well, that's the thing with a highly tuned, precision engine like your mind, JosAH. Adding a little alchohol to the fuel mix provides a performance boost, but as the alcohol/fuel ration increases, the performance improvement peaks and then degrades, until the performance is actually reduced. Now, I understand that in the case of the magic Grolsch, this performance curve is shifted farther to the right (graphed with Grolsch count as the independent variable, and performance improvement as the dependent variable), but it still occurs.
    I recommend nitrous oxide. You may need to get your piston heads hardened, though.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Importing special characters from text file

    My project requires me to import a text file into a dynamic
    text field by using the loadVariables() function. My problem is
    that the text file contains a ampersign "&" . It seems that the
    ampersign stops the rest of the text from being imported into my
    flash movie. Is there a special character or escape character that
    I can use to allow me to import the ampersign?
    I've tried using the &amp; and setting my dynamic text
    field to HTML. No luck. Oh.. I'm using flash MX :(
    Any ideas?

    Hey I've run into this problem and found the solution lies
    with JavaScript which can read the text just fine and then parse it
    back to Flash as escape characters:
    //JavaScript code:
    var origText = 'blah blah & then i did this & then
    blah blah";
    var newText = String(escape(origText).replace(new
    RegExp('\\+', 'g'), '%2b'));
    FlashWin.sendText(newText); // << this is a reference
    to a flash window with ExternalInterface enabled
    // end
    However, I was using HttpRequest in JS to get my original
    data. So this method is dependent on something other than Flash to
    retrieve the original text (with ampersands).
    I really hope they fix this bug in the future, it can drive
    you nuts....
    -Dan

  • How to send text file as an email attachment havin more than 255 characters

    My requirement is to generate a text file and to send this text file as E-mail attachment. I am using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send the E-mail. but here the limitation is the number of characters per line must not be more than 255 characters whereas in my case it is exceeding 1000 characters per line. could anyone please suggest me what should i do now ? Each field in the text file has to be tab delimited.

    Simplest might well be to use javamail API instead of the two tags that Sites provides, e.g. see email - Sending mail attachment using Java - Stack Overflow for a full example.
    Phil

  • Replacing text in a text file with special characters

    Hi all,
    in my test text file i found an interesting issue, where i can't replace text that looks something like this "New Text Document - Copy (2).txt"
    (gc $logeps)|foreach{$_ -replace "$($file.name)",""}|Out-File $logeps
    the context of my $($file.name) is "New Text Document - Copy (2).txt"
    how can i escape the parentheses characters inside of a variable that i am passing?
    thanks

    That should work if you're running PowerShell 3.0 or later, but in older versions, you'd run into errors if you try to run .Replace on an array of strings.
    While I prefer the string .Replace method in this instance, for future reference, if you want to escape a literal string so it can be used in a regular expression, call the [regex]::Escape method:
    $pattern = [regex]::Escape($file.Name)
    (gc $logeps) -replace $pattern | Out-File $logeps

  • Scanning characters in a text file

    Hello, firstly I am trying to get the program to work, then I will use different methods (program description shown in code).
    I have not done Java for a while therefore I do not know if i am on the right track or not - please say. Basicly I have the characters in an array, but when I display them its looks like 160, 160, 12, 13, etc etc i.e. their is a separate number for each character.
    What I need to know is how to I get this number back to a character?
    Thank you anyone
    import java.io.*;
    * Write an application which scans through a text file, and counts
    * (and displays) the occurrences of a particular character (supplied
    * by the user) on each line of the file. Use a method to count the
    * occurrences on one line. The specification of the method should be:
    * private int countCharacters(String line, char c)
    * The method returns the number of �c� character in the line.
    public class TextfileScan2
         public static void main(String[] args)throws Exception
              byte[] byteArray = new byte[100];
              FileInputStream in = new FileInputStream("File.txt");
              int byteRead;
              int index = 0;
              while ((byteRead = in.read()) != -1)
                   byteArray[index] = (byte)byteRead;
                   index++;
              in.close();
              for(int i = 0; i < byteArray.length; i++)
                   System.out.println(byteArray);

    No need to get quite so uptight. Anyway I think I am making progress although what I have does not compile as it says I need to add curly braces to lines 28 and 44.
    Can someone please tell me why I get this error. Maybe the name of the methods - have tried changing but no luck.
    cheers
    import java.io.*;
    * Write an application which scans through a text file, and counts
    * (and displays) the occurrences of a particular character (supplied
    * by the user) on each line of the file. Use a method to count the
    * occurrences on one line. The specification of the method should be:
    * private int countCharacters(String line, char c)
    * The method returns the number of �c� characters in the line.
    public class TextfileScan2
         public int main(String[] args)throws Exception
              BufferedReader in = new BufferedReader(new FileReader("File.txt"));
              String line = null;
              String lines = null;
              while((line = in.readLine()) != null)
                   lines = line;
              countCharacters(line);
         private int countCharacters(String line)
              char[] charArray = line.toCharArray();
              int c = 0;
              for(int i = 0; i < charArray.length; i++)
                   if(charArray[i] == 'c')
                        c++;
              System.out.print("There are " + c + " 'c' characters in line");
    }

Maybe you are looking for