Author Topic: Dumb String Question  (Read 4964 times)

Bandersnatch

  • Community Member
  • Posts: 7
  • Hero Points: 0
Dumb String Question
« on: January 10, 2007, 08:24:34 PM »
Hi there,

I'm a bit of a newbie to the SlickEdit thing, and I'm looking for a function that saves a string in a specified file.  I've been able to easily open a file and place the contents into a string using GetFileContents, but I can't seem to find the reverse.

Something along the lines of Put(_str filename, _str text), maybe?  Or should I be doing this a different way?

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Dumb String Question
« Reply #1 on: January 10, 2007, 11:10:00 PM »
You can use sth. like that to (invisibly) manipulate a buffer and finally save / discard it.

Code: [Select]
...
   _str text2save = "Hello Bandersnatch";
   _str fname = "Bandersnatch.txt";

   int temp_view_id=0;
   int orig_view_id=_create_temp_view(temp_view_id);

    // do sth. more useful ;)
    bottom_of_buffer ();
   _insert_text ( text2save );

   // save it if you want
   save_as ( get_env ("TEMP") "\\" fname)

   _delete_temp_view(temp_view_id);
   activate_window(orig_view_id);
...

Have fun,

HS2
« Last Edit: January 10, 2007, 11:17:03 PM by hs2 »

Bandersnatch

  • Community Member
  • Posts: 7
  • Hero Points: 0
Re: Dumb String Question
« Reply #2 on: January 11, 2007, 02:30:07 PM »
Works Beautifully.   :)

Thanks!