Author Topic: vinculum II pendrive interfacing  (Read 13380 times)

zaftblitz

  • Member
  • ***
  • Posts: 4
vinculum II pendrive interfacing
« on: December 08, 2011, 10:08:27 pm »
hello all, i want to ask about the vinculum II. what i want to do is to read some file in the usb pendrive. but what i want to do is, i want it to saperate into some folder. i manage to read/write file without the folder but when the file is in the folder and i want to write the file into the folder, it cannot be done. i had already go though the other forum, example, etc, but still cannot solve for this vinculum II. can anyone help me? A.S.A.P please

i want to read/write file in the folder (eg: F:\00\001.txt). i want to read that 001.txt file but cannot happen. i can only manage to read/write file when the file is not in the folder.. please anyone can help me?  ???

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: vinculum II pendrive interfacing
« Reply #1 on: December 09, 2011, 02:10:07 pm »
Any error message?

I can't claim to have experience with the Vinculum API, but if you post the relevant code (working and non-working), maybe someone will see something.

Jan

zaftblitz

  • Member
  • ***
  • Posts: 4
Re: vinculum II pendrive interfacing
« Reply #2 on: December 10, 2011, 08:35:06 am »
Any error message?

I can't claim to have experience with the Vinculum API, but if you post the relevant code (working and non-working), maybe someone will see something.

Jan

no error message occur but it's only cannot happen when i want to read/write data in the folder directory on USB pendrive

what i means in this part?  cannot read/write file "03-001-001.txt" in "03" folder

Code: [Select]
fsAttach(hFAT_FILE_SYSTEM);
fileRead = fopen("03\\03-001-001.txt", "r");
file = fopen("03\\03-001--001.txt","w");
if (file == NULL)
{
leds = led3;
vos_dev_write(hGPIO_PORT_A, &leds, 1, NULL);
vos_delay_msecs(1000);
break;
}

  fseek (fileRead , 0 , SEEK_END);
  lSize = ftell (fileRead);
  rewind (fileRead);

buffer = (char*) malloc (sizeof(char)*lSize);
result = fread (buffer,1,50,fileRead);

if (fwrite((buffer), strlen(buffer), sizeof(char), file) == -1)
{
leds = led3;
vos_dev_write(hGPIO_PORT_A, &leds, 1, NULL);
vos_delay_msecs(1000);
}
if (fclose(file) == -1)
{
leds = led3;
vos_dev_write(hGPIO_PORT_A, &leds, 1, NULL);
vos_delay_msecs(1000);
}
if (fclose(fileRead) == -1)
{
leds = led3;
vos_dev_write(hGPIO_PORT_A, &leds, 1, NULL);
vos_delay_msecs(1000);
}

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: vinculum II pendrive interfacing
« Reply #3 on: December 10, 2011, 09:52:30 am »
Does fopen succeed?

What does fread return?

Viewing the data on a protocol analyzer might also offer a clue.

Jan

zaftblitz

  • Member
  • ***
  • Posts: 4
Re: vinculum II pendrive interfacing
« Reply #4 on: December 11, 2011, 06:42:26 am »
Does fopen succeed?

What does fread return?

Viewing the data on a protocol analyzer might also offer a clue.

Jan

if i want to read/write file not in the folder, it succeed but when i want to read/write file in the folder, it fail. it will create some "unknown file" like picture below



[attachment deleted by admin]

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: vinculum II pendrive interfacing
« Reply #5 on: December 11, 2011, 09:47:52 am »
What values do fopen and fread return?

Is the "unknown" file in the correct directory?

Jan

zaftblitz

  • Member
  • ***
  • Posts: 4
Re: vinculum II pendrive interfacing
« Reply #6 on: December 11, 2011, 11:09:45 pm »
What values do fopen and fread return?

Is the "unknown" file in the correct directory?

Jan

the unknown file is not in the correct directory. i want to the to be in the "03 folder" but the unknown file is in the outside the folder.
the unknown file cannot be open nor delete.
i dont know the value of Fopen & fread return

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: vinculum II pendrive interfacing
« Reply #7 on: December 12, 2011, 10:14:18 am »
i dont know the value of Fopen & fread return

The value returned by fopen is the value of the "file" variable.

The value returned by fread is the value of the "result" variable.

Does the Vinculum use backslashes or forward slashes?

Did you try:

fileRead = fopen("/03/03-001-001.txt", "r");

Jan
« Last Edit: December 12, 2011, 12:18:27 pm by Jan Axelson »