Problem with wip_putFile()

Hi everybody!

I’m using the lastest version of OpenAT sdk with the FTP library.

If I use the wip_putFile() function like this one,

wip_putFile(ch, "test.dat", FTPFileHandler, NULL);

it works OK. But if I do this:

ascii fil[10];

strcpy(fil, "test.dat");

wip_putFile(ch, fil, FTPFileHandler, NULL);

the file name received by the FTP server isn’t valid, and the file isn’t created.

Does wip_putFile() have a problem with char pointers?

Hi, Pablo!

Maybe you’d better use sprintf function like this:

ascii Filename[10];

In my project it works fine.


In what way is it “not valid”?

It is very difficult to try to solve a problem when you don’t provide full details of what the problem actually is! :unamused:

This doesn’t say much, since depending on the module you use, there are different versions of OpenAT. It is probably a good idea to be more specific on the version numbers than that. Also it will help people in the future not to go through release notes to figure out what the latest version was today…

Best Regards,

Hi again! Thanks for answering :smiley:

I’m sorry I wasn’t specific, so here are some details:

The module is Q2686H, the WIP version is 2.00.15.

When I said “isn’t valid” I mean that when using a pointer to the string in putFile(), the string that follows “STOR” command is like “p” instead of “test.dat”. I can see this in the log of the FTP server and the message “Unable to open file. The file name, directory or volume label is not valid.”

Here’s a copy of the log screen:

Jun 05 08:17:24  0  Incoming connection request on interface
Jun 05 08:17:24  0  Connection request accepted from
Jun 05 08:17:25  0  USER anonymous
Jun 05 08:17:25  0  331 User anonymous, password please  
Jun 05 08:17:25  0  PASS ***********
Jun 05 08:17:25  0  230 Password Ok, User logged in  
Jun 05 08:17:25  0  Anonymous user "anonymous" logged in with password ""
Jun 05 08:17:25  0  TYPE I
Jun 05 08:17:25  0  200 Type Binary  
Jun 05 08:17:26  0  PORT 200,49,201,26,229,221
Jun 05 08:17:26  0  200 Port command received  
Jun 05 08:17:26  0  STOR ``p
Jun 05 08:17:26  0  150 Opening data connection  
Jun 05 08:17:26  0  Unable to open file: El nombre de archivo, directorio o etiqueta del volumen no es válido.  
Jun 05 08:17:26  0  500 File transfer failed  
Jun 05 08:17:28  0  QUIT 
Jun 05 08:17:28  0  Connection terminated.

amat79, I’ve tried your code with the same result :frowning: thanks anyway!

Regards :wink:

That pretty much looks like the pointer pointed to something wrong.
Did you use the varibale fil as local variable that might not be available when the wip_putFile() uses the pointer value?

You might want to try

static ascii fil[10]; 

in this case…

Best Regards,

Thanks jan!

Declaring fil[] as a static array solves the problem! You’re right :wink:

Thanks a lot! :smiley: