/[projet1]/public/pc/tools/osdk/main/bas2tap/sources/bas2tap.cpp
Defence Force logotype

Diff of /public/pc/tools/osdk/main/bas2tap/sources/bas2tap.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1126 by Jylam, Tue May 6 21:15:53 2014 UTC revision 1127 by Hialmar, Fri May 9 20:01:39 2014 UTC
# Line 236  void Bas2Tap(const char *sourceFile,cons Line 236  void Bas2Tap(const char *sourceFile,cons
236      printf("Can't open file for writing\n");      printf("Can't open file for writing\n");
237      exit(1);      exit(1);
238    }    }
239    fwrite(head,1,14,out);    fwrite(head,1,13,out);
240      // write the name
241      if (currentFile.length > 0) {
242              char *fileName = strdup(currentFile.c_str());
243              // only take the file name from the path
244              // try to find \\  
245              char *lastsep = strrchr(fileName, '\\');
246              if (lastsep != NULL) {
247                      // if there is something after the separator
248                      if (lastsep + 1 != 0)
249                              fileName = lastsep + 1;
250              }
251              else {
252                      // try to find /
253                      lastsep = strrchr(fileName, '/');
254                      if (lastsep != NULL) {
255                              // if there is something after the separator
256                              if (lastsep + 1 != 0)
257                                      fileName = lastsep + 1;
258                      }
259              }
260              // remove the extension if there is one
261              char *lastdot = strrchr(fileName, '.');
262              if (lastdot != NULL)
263                    *lastdot = 0;
264              fwrite(fileName, 1, strlen(fileName), out);
265              free(fileName);
266      }
267      fwrite("\x00", 1, 1, out);
268    fwrite(buf,1,i+1,out);    fwrite(buf,1,i+1,out);
269      // oricutron bug work around
270      //fwrite("\x00", 1, 1, out);
271    fclose(out);    fclose(out);
272  }  }
273    
# Line 272  int main(int argc, char **argv) Line 302  int main(int argc, char **argv)
302      "  -b2t[0|1] for converting to tape format with autorun (1) or not (0)\r\n"      "  -b2t[0|1] for converting to tape format with autorun (1) or not (0)\r\n"
303      "  -t2b for converting from tape format text\r\n"      "  -t2b for converting from tape format text\r\n"
304      "  -color[0|1] for enabling colored comments"      "  -color[0|1] for enabling colored comments"
305      "\r\n"          "\r\n"
306      "Exemple:\r\n"      "Exemple:\r\n"
307      "  {ApplicationName} -b2t1 final.txt osdk.tap\r\n"      "  {ApplicationName} -b2t1 final.txt osdk.tap\r\n"
308      "  {ApplicationName} -t2b osdk.tap program.txt\r\n"      "  {ApplicationName} -t2b osdk.tap program.txt\r\n"

Legend:
Removed from v.1126  
changed lines
  Added in v.1127

  ViewVC Help
Powered by ViewVC 1.1.26