Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Creating a file with C

70 views
Skip to first unread message

dimandja

unread,
Mar 28, 2012, 11:40:54 AM3/28/12
to
Can you show the actual call (and parameter values) you are making?

dimandja

unread,
Mar 28, 2012, 11:48:52 AM3/28/12
to
On Mar 28, 11:40 am, dimandja <demou...@yahoo.com> wrote:
> Can you show the actual call (and parameter values) you are making?


Another thought, are you naming the file you want to create? If the
file is not named, you'll get a temporary file.

mustlearntandem

unread,
Mar 28, 2012, 4:39:01 PM3/28/12
to
On Mar 28, 12:39 pm, Mehrzad Irani <i.mehr...@gmail.com> wrote:
> Yes I am naming the file I want to create.
>
> My code goes like this:
>
> #include <stdioh>
> ...
> #include <cextdecs(FILE_CREATE_)>
>
> int main(){
> char *filename="file123";
> int d;
>
> d = FILE_CREATE_(filename, strlen(filename));
>
> ...
>
> return 0;
>
> }
>
> And, I have tried with the filename being "\abc.$def.ghi.jkl" and it still hadn't worked.
>
> However using the simple C API of fopen to create a file, worked, but in the creation of the file I couldn't mention the pext, sext, recordsize, maxextents etc...
>
> Any help?

Have you checked the return code? You might try declaring filename as
an array rather than a pointer and see if your luck improves.

dimandja

unread,
Mar 28, 2012, 4:31:46 PM3/28/12
to
A brief syntax of that call in C should be:

short FILE_CREATE_ ( char *filename
,short maxlen
,short *filenamelen

What's the actual filename returned by that call?
What's the returned length? Use the third variable to receive the
returned length.
Any error returned?

dimandja

unread,
Mar 30, 2012, 12:13:49 PM3/30/12
to
On Mar 30, 2:57 am, Mehrzad Irani <i.mehr...@gmail.com> wrote:
> Thank you dimandja,
>
> I realized I hadn't parsed all the parameters. Left out filenamelen.
>
> The code compiles... however, execution time I get this error:
>
> $SD01 IRANI 70> te2
> \abc.$:1:1089:230834208 - *** Run-time Error 002 ***
> \abc.$:1:1089:230834208 - Illegal address reference
>
> Any help?
Initialize maxlen with the length of the VARIABLE "filename": that's
the length of a fully qualified file name -- try at least 26.
Initialize filenamelen with the length of the VALUE you are sending in
"filename".

mustlearntandem

unread,
Mar 30, 2012, 4:43:10 PM3/30/12
to
Also, don't forget to pass filename and filenamelen as pointers. Often
an illegal address reference results when a parameters is passed by
value instead of the expected pointer.
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages