logo
down
shadow

How to print files with same month of modification using directory in c?


How to print files with same month of modification using directory in c?

By : user2956509
Date : November 22 2020, 10:56 AM
I think the issue was by ths following , You are closing the directory stream in wrong place. You are closing that in the inner while but you have to close that after the outer while.
code :
if (da != NULL) 
{
 while (ep = readdir (da)) 
   while ((ep = readdir (da)) != NULL)
   {
    const size_t len = strlen(ep->d_name);   

    if (len > 4                    &&
        ep->d_name[len - 4] == '.' &&
        ep->d_name[len - 3] == 't' &&
        ep->d_name[len - 2] == 'x' &&
        ep->d_name[len - 1] == 't') {

            stat(ep->d_name, &attrib); 
            foo = localtime(&(attrib.st_mtime));

            if(foo->tm_mon+1 == 1) {


             printf ("%s\n", ep->d_name);
                }
        }
   }
 closedir (da); 
}
int strcmp(const char *s1, const char *s2);

if ( strcmp(ep->d_name+(len-4),".txt") ==0 ){ 
...
}


Share : facebook icon twitter icon
Getting last modification date of files in directory using PHP

Getting last modification date of files in directory using PHP


By : Manfred.P
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I am trying to get the last modification date of all files in a directory using PHP. , Check if the $file var is actually pointing to a correct file
code :
foreach($dir as $file) 
{
  if(is_file($file))
  {
    $mod_date=date("F d Y H:i:s.", filemtime($file));
    echo "<br>$file last modified on ". $mod_date;
  }
  else
  {
    echo "<br>$file is not a correct file";
  }
}
How to delete all files and directory under a given directory based on modification time greater than 2 days

How to delete all files and directory under a given directory based on modification time greater than 2 days


By : Nitish
Date : March 29 2020, 07:55 AM
To fix the issue you can do Based on what I read from the the python docs, the following wouldn't be equivalent, but it would be close:
code :
do {
   opendir(my $dh, $path)
      or die("Can't open directory \"$path\": $!\n");

   my @files = grep !/^\.\.?\z/, readdir($dh);

   closedir($dh)
      or die("Error reading directory \"$path\": $!\n");

   @files
}
How to traverse directory in order of modification date without visiting all files in directory at least once in Python

How to traverse directory in order of modification date without visiting all files in directory at least once in Python


By : user2894666
Date : March 29 2020, 07:55 AM
With these it helps No, I don't think there is a way to fetch file names in chunks sorted by modification dates.
You should use file system notifications to know about modified files.
Display one print dialog box to print multiple files in directory or send all files to printer

Display one print dialog box to print multiple files in directory or send all files to printer


By : Lalit
Date : March 29 2020, 07:55 AM
may help you . I'm using WinForms. I want to be able to print all TIF images in a particular directory. The problem with my code is that when i try to print all the tif images, the print dialog box opens up for each tif images. For example, If I have 10 tif images in the direcotry, the print dialog box will open up 10 times for each tif image. , You could use a PrintDocument object along with a PrintPreviewDialog:
code :
private PrintDocument printDoc;
private PrintPreviewDialog printPreview;
List<string> elements = new List<string>();
private int ElementCounter;
private int page;

printDoc.BeginPrint += PrintDoc_BeginPrint;
printDoc.PrintPage += PrintDoc_PrintPage;

private void PrintDoc_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
    page = 0;
}

private void PrintDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
    e.Graphics.DrawImage(Image.FromFile(elements[page]), e.MarginBounds);
    page++;
    e.HasMorePages = page < elements.Count;
}

private void btn_Print_Click(object sender, EventArgs e)
{
    DirectoryInfo directory = new DirectoryInfo(@"C:\image\Shared_Directory\Printing_Folder\");
    FileInfo[] Files = directory.GetFiles("*.tif"); //Getting Tif files


    foreach (FileInfo file in Files)
    {              
        elements.Add(file.FullName);
        ElementCounter++;
    }

    printPreview.Document = printDoc;
    printPreview.Show();
}
Apache Camel: How do I do a simple modification on files in one directory, then store the output in another directory?

Apache Camel: How do I do a simple modification on files in one directory, then store the output in another directory?


By : cozmo101
Date : March 29 2020, 07:55 AM
this will help If you want to modify the file content, you need to put the processor between the "from" and "to" endpoints.
Related Posts Related Posts :
  • Undefined-Behavior at its best, is it -boundary break? -bad pointer arithmetic? Or just -ignore of aliasing?
  • Why am i getting problem3.c:20:23: error: expected expression before ‘int’?
  • Right Justified Zero filled String in C
  • C Function with parameter without type indicator still works?
  • How to transmit data from an interrupt handler to an user application?
  • Why do I get the error "bash: ./a.out: Permission denied" when I execute a C program in Linux mint 15
  • syntax of sigchld and its declaration
  • error using g_idle_add() in C++, same thing works in C
  • why if else or nested if else are called single statement in C
  • How do I interpret this printf in C
  • load the functions of a shell script without executing it
  • Is FilterSendNetBufferLists handler a must for an NDIS filter to use NdisFSendNetBufferLists?
  • How to write to flash memory using inline assembly?
  • More Return Statements vs. More Indentation
  • How to show an image on a PictureBox from resource?
  • Having malloced some memory,I could't calculator the proper size of the memories I malloced.I don't know why
  • What is the main difference between integer pointer and character pointer?
  • Why are some functions declared extern and header file not included in source in Git source code?
  • what is the use of fflush(stdin) in c programming
  • Is it safe to return file File descriptor locally allocated from another function In C
  • Changing undefined values of an array
  • What does an empty parameter list mean?
  • using strtol on a string literal causing segmentation fault
  • Same structure objects memory overlap?
  • C-Linux-Any way to pass command "history" to Linux shell?
  • Using #define in defining string size C
  • How to use thread pool and message queues in Multithreaded Matrix Multiplication?
  • Can't find how to select path to run a C program
  • Automatic variable in C not initialized but given fixed value within loop
  • main() function defined without return type gives warning
  • Output of following code with integer, float, char variable
  • why buffer memory allocation error in opencl
  • Why am I getting this error during run-time?
  • Strange behaviour of the pow function
  • task in increment , decrement , printf() , why these are evaluated in this manner in C
  • 28 extra bytes in bss
  • Waiting for multiple events without polling
  • Why are my variables reporting as "undeclared identifier" when compiling?
  • Correct AddNode function but somehing happens when I printf
  • When I traverse in the splay tree, then now which one is root?
  • Data type conversion in Postfix evaluation
  • No output in terminal (Head First C)
  • Data writes over after realloc
  • function: findnextchar() doesn't work
  • Getting file-size property from Nautilus
  • Forward declare entities in C standard library?
  • Static array in C
  • Function signature indicates return type void*, but returns pointer of a different type
  • How do I measure time per thread in C?
  • Online judgeProblem (Wrong Answer)
  • Use function pointer initialized in other source file
  • last line of file is duplicated using fscanf
  • ADT Circular Queue enqueue and dequeue
  • What events can cause ferror to return non-zero?
  • Accessing dynamically allocated structure received through socket
  • Vim with C Conditional Parsing
  • C can pointers be aligned with any other data type?
  • sdcc inline asm() not working
  • I/O - Manipulation of C Strings
  • sscanf 1 byte hex data without overflow
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org