Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Posts
    8

    Unanswered: Using fwprintf for writting input file for osql using -u (unicode)

    Hi,
    I'm writting the input sql file for osql CLI using a C program, using fopen(file, "wb"); and later using fwprintf(..)
    But osql is giving me syntax error on executing the sql file.
    Any ideas?
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2003
    Posts
    522
    what error are you getting? it runs ok here.

  3. #3
    Join Date
    Sep 2003
    Posts
    522
    ooops, too fast too early. i copied the statement from textpad and ran it in qa, - that's why it worked. then i tried to run it with -i in osql and it croked with "Could not find stored procedure 'S'" message. i looked into the file with binary editor and noticed that you separate each character by null character.

  4. #4
    Join Date
    Sep 2003
    Posts
    8
    Thanks the reply!
    I could solve the problem, say by a crook method.
    I was concerned about the two bytes at the start of any UNICODE file with WCHARs.
    I used fwprintf to create an UNICODE file, and then feed this file as an input file to the osql CLI.
    osql CLI was able to identify the input file as UNICODE file, because the start of file didn't had the FFFE signature.
    Using fwrite.. I inserted FFFE at the start of the file and then used fwprintf
    Now the File is acceptable to osql!

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •