English Amiga Board


Go Back   English Amiga Board > Main > Retrogaming General Discussion

 
 
Thread Tools
Old 19 October 2001, 11:33   #1
Big-Byte
Long time member

Big-Byte's Avatar
 
Join Date: Jul 2001
Location: UK
Posts: 753
Anyone know C++ ?

Ive just started to learn C++ and am trying to write a program
to report / rename any of my adf files that are over 64 chars long to < 64 chars (So I can put them on cd)

Code Ive done so far..

#include <stdio.h>
#include <iostream.h>
#include <string.h>

int main(int argc, char *argv[])
{

char *old_file_name;
int ofn_length = 0; // Old filename length

char new_file_name[64];

int temp;

old_file_name = argv[1];
ofn_length = strlen(old_file_name);

cout << "Arg count = " << argc << "\n" ;
cout << "File name passed in = " << old_file_name << "\n";
cout << "Length of file name = " << ofn_length << "\n" ;

cin >> temp;

return 0;
}

Problem is when I call my program passing in filenames, the filenames passed in are the dos 8:3 format and not the long format.

Any help would be appreciated.
Big-Byte is offline  
AdSense AdSense  
Old 19 October 2001, 12:11   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,935
Quote:
Problem is when I call my program passing in filenames, the filenames passed in are the dos 8:3 format and not the long format.
Your C++ compiler does not support long file names/is configured incorrectly. You need to compile your program as Win32 Console (I guess you are using Windows)

Some DOS-compilers also support long file names. Don't ask me, I am trying to forget DOS completely... (extended memory, high memory, base memory, eaarghh
Toni Wilen is online now  
Old 19 October 2001, 14:11   #3
Big-Byte
Long time member

Big-Byte's Avatar
 
Join Date: Jul 2001
Location: UK
Posts: 753
Thanks for your reply..

Since I posted the last message Ive change C++ compilers already..

I was using the bloodshed one but am now using lcc-win32. It appears to have lots more options..

Put me down as a future developer of WinUAE wont you (In a couple of years at least)
Big-Byte is offline  
Old 28 October 2001, 00:00   #4
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 43
Posts: 5,858
Send a message via ICQ to andreas Send a message via AIM to andreas
A small tip...

Quote:
cout << "File name passed in = " << old_file_name << "\n";
cout << "Length of file name = " << ofn_length << "\n" ;
Don't use that C style "\n" in C++, use endl instead.
endl has the advantage of flushing the text buffer which can be very important for some console programs - a C++ program may tend to "hang" until next user input!

Thus...

cout << "File name passed in = " << old_file_name << endl;

is the same as

cout << "File name passed in = " << old_file_name;
cout.flush();

Happy coding!
andreas is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:14.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.10510 seconds with 10 queries