I changed it to this so the folders are created correctly but it still doesnt work!
almost about to cry now!!
thanks for your help so far!
Code:
#include <stdio.h>
#include <windows.h>
#include <iostream>
#include <stdlib.h>
#include <time.h>
// *****************************************************************
// This portion checks to see if you are in the right directory
// If Year is non-existant then new Year folder is created
// If Day is non-existant then new Day is created within year
// Dates are taken from GPS Conversion portion
// *****************************************************************
void main() {
int year, hour, day, PRN, prev_year, prev_hour, prev_day;
{
year = 2100;
day = 100;
PRN = 122;
hour = 20;
prev_year = 1999;
prev_hour = 19;
prev_day = 99;
char string_variable [200];
(prev_year = year - 1);
(prev_hour = hour - 1);
(prev_day = day - 1);
if (year == prev_year + 1) {
sprintf(string_variable, "c:\\temp\\PRN%3d\\Y%4d", PRN, year, day, hour);
CreateDirectory("c:\\temp\\PRN%3d\\Y%4d", NULL);
printf("new year created\n");
}else{
(sprintf(string_variable, "c:\\temp\\PRN%3d\\Y%4d\\d%3d\\h%2d.ems", PRN, year, day, hour) == NULL);
}
if (day == prev_day + 1) {
sprintf(string_variable, "c:\\temp\\PRN%3d\\Y%4d\\d%3d", PRN, year, day, hour);
CreateDirectory("c:\\temp\\PRN%3d\\Y%4d\\d%3d", NULL);
printf("new day created\n");
}else{
(sprintf(string_variable, "c:\\temp\\PRN%3d\\Y%4d\\d%3d\\h%2d.ems", PRN, year, day, hour) == NULL);
if (hour == prev_hour + 1) {
sprintf(string_variable, "c:\\temp\\PRN%3d\\Y%4d\\d%3d\\h%2d.ems", PRN, year, day, hour);
CreateDirectory("c:\\temp\\PRN%3d\\Y%4d\\d%3d\\h%2d.ems", NULL);
printf("new hour created\n");
}else{
(sprintf(string_variable, "c:\\temp\\PRN%3d\\Y%4d\\d%3d\\h%2d.ems", PRN, year, day, hour) == NULL);
}
}
}
}